我在iphone中遇到了问题,当我想在我的应用程序页面的小键盘(文本字段填充)中使用自定义按钮时。我在键盘上嵌入了一个名为dot的按钮,它显示正常,但是当我点击它时,它应该转到我定义的操作。但它崩溃。iphone中的自定义小键盘按钮
- (void)sendDecimal:(id)sender {
// Post a Notification that the Decimal Key was Pressed.
[[NSNotificationCenter defaultCenter] postNotificationName:@"DecimalPressed" object:nil];
}
它运行直到应用程序试图发送通知我不知道可能是例程或函数或方法。
有人可以帮我解决这个问题。
感谢
编辑
以下是错误消息:
-[UITableView addDecimal:]: unrecognized selector sent to instance 0x4051e00
2010-03-26 16:08:42.272 app[2855:20b]
Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '-[UITableView addDecimal:]: unrecognized selector sent to instance
0x4051e00'
编辑
我已经定义了addDecimal选择,这里是代码... ...
- (void)viewDidAppear:(BOOL)animated {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:tableView selector:@selector(addDecimal:) name:@"DecimalPressed" object:nil];
编辑
是的,我已经写了这个作为 [点addTarget:自我行动:@选择(sendDecimal :) forControlEvents:UIControlEventTouchUpInside]。
您可以复制并粘贴在控制台中的错误信息?这将非常有帮助。 – 2010-03-26 11:06:57
*** - [UITableView addDecimal:]:无法识别的选择器发送到实例0x4051e00 2010-03-26 16:08:42.272应用程序[2855:20b] ***终止应用程序,由于未捕获异常'NSInvalidArgumentException',原因:' *** - [UITableView addDecimal:]:无法识别的选择发送到实例0x4051e00' – 2010-03-26 11:10:24
是一个拼写错误...? – 2010-03-26 11:14:33