[英]ABPeoplePickerNavigationController hide cancel button
I'm subclassing ABPeoplePickerNavigationController
and I was wondering how to hide the right toolbar item " Cancel
"? 我是ABPeoplePickerNavigationController
子类,我想知道如何隐藏正确的工具栏项“ Cancel
”?
I've been searching but I couldn't find the right solution. 我一直在寻找,但我找不到合适的解决方案。
Thanks! 谢谢!
Use <UINavigationControllerDelegate>
使用<UINavigationControllerDelegate>
After ABPeoplePickerNavigationController alloc
delegate it to self. 在ABPeoplePickerNavigationController alloc
之后将委托委托给自己。
peoplePicker.delegate = self;
We will need to override an UINavigationController
's delegate method. 我们需要覆盖UINavigationController
的委托方法。
// 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;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.