我在這裏撕掉我的頭髮。閱讀了很多描述如何解決這個問題的例子,但沒有人幫助我擺脫了這個問題。NSInvalidArgumentException
在UIView鏈接到IBAction上有一個簡單的按鈕。
代碼是這樣的......
Contact.h
#import <UIKit/UIKit.h>
@interface Contact : UIViewController {
}
-(IBAction)buttonPressed:(id)sender;
@end
Contact.m
#import "Contact.h"
@implementation Contact
- (IBAction)buttonPressed:(id)sender
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Button Pressed" message:@"You pressed the button" delegate:nil cancelButtonTitle:@"Yep, I did." otherButtonTitles:nil];
[alert show];
[alert release];
}
不斷收到此錯誤信息:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIViewController buttonPressed:]: unrecognized selector sent to instance 0xd1d5f0'
觸摸的內心鏈接到該文件所有者使用buttonPressed。
已經下載了其他示例代碼,它們工作正常。我的項目和筆尖的設置與其他示例代碼完全相同。
還沒有一個線索,甚至開始嘗試和調試。
任何幫助?
代碼看起來像什麼來建立TouchUp事件回調? – fbrereto 2009-08-31 18:01:17