Problem with UIBarButtonItem
Im having a problem trying to get my home button UIBarButtonItem back to my initial ViewController.
I have this code within the viewDidLoad method:
// Create a home button
UIBarButtonItem *homeButton = [[UIBarButtonItemalloc] initWithTitle:@"Home"style:UIBarButtonItemStylePlaintarget:selfaction:@selector(goHome:)];
[self.navigationItemsetLeftBarButtonItem:homeButton animated:NO];
// Go to home page
- (void) goHome {
ViewController *view1 = [[ViewControlleralloc]initWithNibName:@"ViewController"bundle:nil];
[selfpresentViewController:view1 animated:YEScompletion:nil];
}
When I try and invoke the function goHome by clicking the button, I get NSInvalidArgumentException
Thanks in advance 🙂