我在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