Reputation: 23
I am new in objective C. I don't know much more things about this. I am practicing on navigation controller. The problem is that whatever methods I am putting in action:@selector
in shows SIGABRT
error.
could you clarify me which types of methods i can put in action:@selector
section.
Though I know it's a silly question but I think these will clear my concept over navigationViewController
.
thank you.
- (void)viewDidLoad
{
UISearchBar *search=[[UISearchBar alloc] init];
self.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemSearch target:self action:@selector(searchBarShouldBeginEditing:)];
[super viewDidLoad];
}
- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar{
UISearchBar *search=[[UISearchBar alloc] init];
[search resignFirstResponder];
return YES;
}
Upvotes: 0
Views: 63
Reputation: 2375
Try moving your '[super viewDidLoad]' to the beginning of the viewDidLoad method, not the end. YOu need to make sure the controls exist before you add the right bar button item.
Upvotes: 1