我用一個textview製作了一個應用程序,當您點擊它時,會出現一個日期選擇器。我的代碼有問題嗎?當我更改日期選擇器上的時間時,應用程序崩潰
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(112, 88, 97, 30)];
textField.borderStyle = UITextBorderStyleRoundedRect;
textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
[self.view addSubview:textField];
UIDatePicker *datePicker = [[UIDatePicker alloc] init];
datePicker.datePickerMode = UIDatePickerModeDate;
[datePicker addTarget:self action:@selector(datePickerValueChanged:) forControlEvents:UIControlEventValueChanged];
[textField setInputView:datePicker];
我收到錯誤2013-08-04 20:38:54.249 Habit Pal[7252:c07] -[SleepModeViewController datePickerValueChanged:]: unrecognized selector sent to instance 0x8840d70
喜只實現 - (空)datePickerValueChanged:(的UIDatePicker){日期選擇器// 把什麼你想發生的價值變化 } – Rajneesh071