我在这里撕掉我的头发。阅读了很多描述如何解决这个问题的例子,但没有人帮助我摆脱了这个问题。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