2009-10-14 150 views
11

我想禁用選擇我的UIPickerView中的某些行。就像在Coundown計時器中,您嘗試選擇0,它不會讓您滑回到1或您如何限制日期在Date Picker ...UIPickerView禁用行選擇

如何禁用行UIPickerView

回答

23

UIPickerView委託方法

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component 

您可以檢查是否該選擇是有效的,滾動到適當的行如果沒有(用pickerview的

- (void)selectRow:(NSInteger)row inComponent:(NSInteger)component animated:(BOOL)animated 

方法。)

看起來標準時鍾應用程序就是這樣工作的。