ABPeoplePickerNavigationController透明顶栏

时间:2014-11-04 16:34:25

标签: ios objective-c xcode6 transparency transparent

我使用标准的ABPeoplePickerNavigationController,当我用联系人拖动表格时,我看到顶栏是透明的。我无法解决它。看起来很糟糕。

我尝试将[UIColor whiteColor]设置为我能够达到的一切:navigationBar,ABPeoplePickerNavigationController的所有子视图以及它的topViewController的所有子视图。我试图为导航栏设置不同的栏样式。没什么帮助。

Transperent top

这是代码

@interface MNFindClientVC () <ABPeoplePickerNavigationControllerDelegate>
@property (nonatomic, strong) ABPeoplePickerNavigationController *addressBookController;
-(void)openPhoneBook;
@end

@implementation MNFindClientVC
-(void)viewDidLoad
{
        [super viewDidLoad];
        self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"phonebook"] style:UIBarButtonItemStyleBordered target:self action:@selector(openPhoneBook)];
        self.addressBookController = [[ABPeoplePickerNavigationController alloc] init];
        self.addressBookController.peoplePickerDelegate = self;
}

-(void)openPhoneBook
{
    [self presentViewController:self.addressBookController animated:YES completion:nil];
}
@end

抱歉我的英文。谢谢:))

1 个答案:

答案 0 :(得分:1)

使用半透明的UINavigationBar时遇到了同样的问题。您可以通过使用以下代码(在iOS 8中测试)在ABPeoplePickerNavigationContrller中禁用UINavigationBar的半透明来解决此问题:

_addressBookController = [[ABPeoplePickerNavigationController alloc] init];
[_addressBookController setPeoplePickerDelegate:self];

[[UINavigationBar appearanceWhenContainedIn:[ABPeoplePickerNavigationController class], nil] setTranslucent:NO];

[self presentViewController:_addressBookController animated:YES completion:nil];