ABPeoplePickerNavigationController隐藏取消按钮

时间:2013-03-05 13:31:51

标签: iphone ios objective-c

我是ABPeoplePickerNavigationController的子类,我想知道如何隐藏正确的工具栏项“Cancel”?

我一直在寻找,但找不到合适的解决方案。

谢谢!

1 个答案:

答案 0 :(得分:14)

使用<UINavigationControllerDelegate>

ABPeoplePickerNavigationController alloc委托给自己后。

peoplePicker.delegate = self;

我们需要覆盖UINavigationController的委托方法。

  

//当导航控制器通过推,弹出或设置视图控制器堆栈显示新的顶视图控制器时调用。

- (void)navigationController:(UINavigationController*)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    if([navigationController isKindOfClass:[ABPeoplePickerNavigationController class]])
        navigationController.topViewController.navigationItem.rightBarButtonItem = nil;
}
相关问题