我有一个
UIViewController
UIDatePicker
数据采集器
在“定时器”模式下,让它调用
datePickerValueDidChange:
发生“值更改”事件时视图控制器的方法。视图控制器中的代码如下所示:
- (void) viewWillAppear:(BOOL)animated {
NSLog(@"datePicker: %@", datePicker);
NSLog(@"datePicker.datePickerMode: %d", datePicker.datePickerMode);
}
datePicker: <UIDatePicker: 0x3b03660; frame = (0 61; 320 216); clipsToBounds = YES; opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x3b033a0>>
datePicker.datePickerMode: 3
这意味着日期选择器已初始化,模式为
UIDatePickerModeCountDownTimer
. 当我通过移动其中一个滚轮来更改值时,它将调用此方法:
- (IBAction) datePickerValueDidChange:(id)sender {
NSLog(@"datePicker.countDownDuration: %@", datePicker.countDownDuration);
}
日志中的输出为:
datePicker.countDownDuration: (null)