我正在对 ABPeoplePickerNavigationController 进行子类化,我想知道如何隐藏正确的工具栏项“Cancel”?
我一直在寻找,但找不到合适的解决方案。
谢谢!
最佳答案
使用 <UINavigationControllerDelegate>
在 ABPeoplePickerNavigationController alloc 之后委托(delegate)给自己。
peoplePicker.delegate = self;
我们需要覆盖 UINavigationController的委托(delegate)方法。
// 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;
}
关于iphone - ABPeoplePickerNavigationController 隐藏取消按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15225086/