【问题标题】:ABPeoplePickerNavigationController transparent top barABPeoplePickerNavigationController 透明顶栏
【发布时间】:2014-11-04 16:34:24
【问题描述】:

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

我尝试将 [UIColor whiteColor] 设置为我能到达的所有内容:navigationBar、ABPeoplePickerNavigationController 的所有子视图以及它的 topViewController 的所有子视图。我尝试为导航栏设置不同的栏样式。没有任何帮助。

这里是代码

@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

对不起我的英语。谢谢:)

【问题讨论】:

  • 对不起,它仍然对我有用,您可以将 rightBarButtonItem 行注释掉并重新测试。

标签: ios objective-c xcode6 transparency transparent


【解决方案1】:

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

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

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

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

【讨论】:

    猜你喜欢
    • 2014-01-31
    • 2014-01-08
    • 2020-11-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-19
    • 1970-01-01
    相关资源
    最近更新 更多