jdo*_*dog 3 iphone objective-c
任何人都知道我为什么会收到此错误?
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CustomRaisedTabViewController cancel:]: unrecognized selector sent to instance 0x4d321e0'
Run Code Online (Sandbox Code Playgroud)
这是它失败的代码.这是我的CustomTabViewController.单击"取消"按钮时发生错误.
-(IBAction)showPostModalViewController {
PostActionModalViewController *addController = [[PostActionModalViewController alloc]
initWithNibName:@"PostActionModalView" bundle:nil];
// Configure the PostAddViewController. In this case, it reports any
// changes to a custom delegate object.
addController.delegate = self;
// Create the navigation controller and present it modally.
UINavigationController *navigationController = [[UINavigationController alloc]
initWithRootViewController:addController];
[self presentModalViewController:navigationController animated:YES];
UIBarButtonItem *cancelButton =
[[UIBarButtonItem alloc] initWithTitle: @"Cancel"
style: UIBarButtonItemStylePlain
target: self
action: @selector(cancel:)];
addController.navigationItem.rightBarButtonItem = cancelButton;
[cancelButton release];
//[self presentModalViewController:addController animated:true];
[navigationController release];
[addController release];
}
-(IBAction)cancel {
[self.parentViewController dismissModalViewControllerAnimated:YES];
}
Run Code Online (Sandbox Code Playgroud)
因为该cancel:方法不是cancel您定义的方法.
将您的cancel操作更改为如下所示:
- (IBAction)cancel:(id)sender {
...
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
18591 次 |
| 最近记录: |