I have a bug in my code and I cannot seem to find it! I've created a button called addButton programatically and set its selector to add—but the app crashes in the simulator every time the button is pressed. Here is my code.
-(void)viewDidLoad{
UIBarButtonItem *addButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self
action:@selector(add:)];
self.navigationItem.rightBarButtonItem = addButton;
[addButton release];
}
and the code for the add button is :
- (IBAction)add
{
MyDetailViewController * detail = [[MyDetailViewController alloc]init];
detail.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:detail animated:YES];
//[detail.text becomeFirstResponder];
[detail release];
}
Thanks for the help guys :D