我正在尝试在 UITabBarController 中显示 iPhone 通讯录中的联系人。我来了这么远:
- (void)contacts
{
ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
// place the delegate of the picker to the controller
picker.peoplePickerDelegate = self;
CGRect newFrame = self.tabBarController.view.frame;
newFrame.size.height = newFrame.size.height - 49;
picker.view.frame = newFrame;
[picker setAccessibilityViewIsModal:YES];
// showing the picker
[self.tabBarController presentModalViewController:picker animated:NO];
}
来电:
-(void)viewWillAppear:(BOOL)animated
{
[self contacts];
}
结果我得到了这个:
- 我看不到标签
- 我的标签样式是黑色的,但选择器是蓝色的。
- 有取消按钮。
如何使标签可见,使样式变黑并摆脱取消按钮?
先感谢您。
编辑:
改变方法后:
-(void)contacts
{
ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;
picker.navigationBar.tintColor=[UIColor blackColor];
// Display only a person's phone, email, and birthdate
NSArray *displayedItems = [NSArray arrayWithObjects:[NSNumber numberWithInt:kABPersonPhoneProperty], nil];
picker.displayedProperties = displayedItems;
// Show the picker
picker.navigationBar.hidden=YES;
CGRect newFrame = picker.view.frame;
newFrame.size.height = newFrame.size.height - 49;
picker.view.frame = newFrame;
[self.tabBarController.view addSubview:picker.view];
}
我得到了这个结果:
是的,联系人位于选项卡内,但现在有问题:
- 当我用联系人触摸 tableView 时,联系人完全消失了。
- 当我切换标签时,联系人视图不会消失,我可以在所有标签中看到它。
- UISearchbar 的一半保持隐藏。
现在邪恶在哪里?