我正在使用 ABPeoplePickerNavigationController,它是 UINavigationController 的子类,在我使用它的上下文中,右侧的默认导航栏按钮“取消”没有任何意义。我找不到禁用或隐藏它的方法,并且无论使用什么方法都需要公开且经过商店批准。 完全摆脱导航栏(picker.navigationBarHidden = YES;)可能是一个选项,除非在弹出回联系人列表后导航栏会重新出现。 子类化 ABPeoplePickerNavigationController 并拦截 viewWillAppear 来尝试取消取消按钮不起作用。 [选择器设置允许取消:否];确实有效,但没有记录,所以我预计永远不会通过批准。
最佳答案
这个
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
UIView *custom = [[UIView alloc] initWithFrame:CGRectMake(0.0f,0.0f,0.0f,0.0f)];
UIBarButtonItem *btn = [[UIBarButtonItem alloc] initWithCustomView:custom];
//UIBarButtonItem *btn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addAction)];
[viewController.navigationItem setRightBarButtonItem:btn animated:NO];
[btn release];
[custom release];
}
完美!
关于iphone - ABPeoplePickerNavigationController - 在不使用私有(private)方法/属性的情况下删除 "Cancel"按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1611499/