我想禁用UIPickerView
中某些行的选择。就像在Coundown计时器中,你试图选择0,它不会让你滑倒回1.或者你如何限制Date Picker
中的日期......
如何禁用UIPickerView
?
答案 0 :(得分:23)
在UIPickerView
委托方法
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
您可以检查此选择是否有效,如果不是,则滚动到相应的行(使用pickerview的
- (void)selectRow:(NSInteger)row inComponent:(NSInteger)component animated:(BOOL)animated
的方法。)
看起来标准时钟应用程序就是这样工作的。