Anyone know why I am getting this error?
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CustomRaisedTabViewController cancel:]: unrecognized selector sent to instance 0x4d321e0'
This is the code where it is failing. This is in my CustomTabViewController
. The error is happening when I click my "Cancel" button.
-(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];
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…