ABPeoplePickerNavigationController导航barStyle BlackTranslucent错位布局

时间:2013-02-28 10:23:17

标签: iphone ios abpeoplepickerview peoplepicker

条形样式为BlackOpaque我的人员选择器如下: enter image description here

但是当我希望barStyle为BlackTranslucent时,它看起来像这样: enter image description here

我尝试过来自here

的解决方案

CODE:

- (void)showPeoplePickerController
{
    ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;

NSArray *displayedItems = [NSArray arrayWithObjects:[NSNumber numberWithInt:kABPersonPhoneProperty],
                           [NSNumber numberWithInt:kABPersonEmailProperty],
                           [NSNumber numberWithInt:kABPersonBirthdayProperty],[NSNumber numberWithInt:kABPersonAddressProperty],nil];

picker.displayedProperties = displayedItems;
picker.navigationBar.barStyle = UIBarStyleBlack;

//  picker.navigationBar.translucent = YES; //uncommented for translucent bar


[self.navigationController presentModalViewController:picker animated:YES];

}

但是如何从PeoplePicker中移除东西?

2 个答案:

答案 0 :(得分:0)

确定代替:

[self.navigationController presentModalViewController:picker animated:YES];

显示您的ABPeoplePickerNavigationController,如下所示:

[self.navigationController presentViewController:picker animated:YES completion:nil];

对于条形颜色,请检查以下行:picker.navigationBar.tintColor=[UIColor blackColor];

答案 1 :(得分:0)

为什么您首先使用半透明导航栏?人员选取器视图控制器不适用于半透明导航栏。

如果您有充分理由这样做,则需要进行一些黑客攻击才能正确显示内容:
您必须修改显示的表视图的contentInset属性,以便内容从导航栏下方开始。

BUT:对不起,无法访问显示的表格视图。