我有一个表格视图,我将其用作表单。第一个单元格有一个可编辑的文本字段。单击第二个单元格时,会加载半模式日期选择器。我用这个:http ://reednj.tumblr.com/post/1346445326/ios-semi-modal-date-picker-for-iphone
无论如何,我已经定义了我的 datepicker 并将它的委托设置在 tableviewcontroller 中,如下所示:
TDDatePickerController* datePickerView = [[TDDatePickerController alloc]
initWithNibName:@"TDDatePickerController"
bundle:nil];
[datePickerView setDelegate:self];
[self presentSemiModalViewController:datePickerView];
现在处理按钮点击的方法被定义为
-(void)datePickerSetDate:(TDDatePickerController*)viewController;
-(void)datePickerClearDate:(TDDatePickerController*)viewController;
-(void)datePickerCancel:(TDDatePickerController*)viewController;
因此,当按下取消按钮时,我希望关闭半模态日期选择器,所以我有:
-(void)datePickerCancel:(TDDatePickerController*)viewController{
[self dismissSemiModalViewController:viewController];
}
但这会使应用程序因错误而崩溃
-[__NSCFType cancelDateEdit:]: unrecognized selector sent to instance 0xe738c00
2012-09-18 10:23:47.254 JRPBaseCamp[7612:f803] *由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[__NSCFType cancelDateEdit:]:无法识别的选择器发送到实例 0xe738c00”
于是查了一下TDDatePickerController中的cancelDateEdit方法:
-(IBAction)cancelDateEdit:(id)sender {
if([self.delegate respondsToSelector:@selector(datePickerCancel:)]) {
[self.delegate datePickerCancel:self];
}
}
我究竟做错了什么?我忽略的东西一定很明显。非常感谢任何帮助,我对 iOS 还很陌生,代表的整个概念真的让我感到困惑。谢谢!