Reputation: 1592
I'm subclassing ABPeoplePickerNavigationController
and I was wondering how to hide the right toolbar item "Cancel
"?
I've been searching but I couldn't find the right solution.
Thanks!
Upvotes: 9
Views: 2012
Reputation: 24248
Use <UINavigationControllerDelegate>
After ABPeoplePickerNavigationController alloc
delegate it to self.
peoplePicker.delegate = self;
We will need to override an UINavigationController
's delegate method.
// Called when the navigation controller shows a new top view controller via a push, pop or setting of the view controller stack.
- (void)navigationController:(UINavigationController*)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
if([navigationController isKindOfClass:[ABPeoplePickerNavigationController class]])
navigationController.topViewController.navigationItem.rightBarButtonItem = nil;
}
Upvotes: 14