我想禁用 UIPickerView
中某些行的选择。就像在倒计时计时器中一样,您尝试选择 0,但它不允许您选择并返回到 1。或者如何在日期选择器
中限制日期...
如何禁用 UIPickerView
中的行?
最佳答案
在UIPickerView
委托(delegate)方法中
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
您可以检查此选择是否有效,如果无效则滚动到相应的行(使用 pickerview 的
- (void)selectRow:(NSInteger)row inComponent:(NSInteger)component animated:(BOOL)animated
方法。)
看起来标准时钟应用程序就是这样工作的。
关于iphone - UIPickerView 禁用行选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1565743/