ABPeoplePickerNavigationController搜索栏颜色并没有改变

时间:2014-10-05 13:07:23

标签: ios objective-c contacts abpersonviewcontroller

我尝试在选择联系人时将搜索栏橙色和条形色调颜色更改为白色。

无论我一直在尝试什么,nothings都会被改变,并且它会像这样被卡住(后退按钮不是白色)。

在AppDelegate中

[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTintColor:[UIColor whiteColor]];
[[UINavigationBar appearanceWhenContainedIn:[UINavigationController class], nil] setBarTintColor:OrangeOfficialColor];

[[UINavigationBar appearance] setBarTintColor:OrangeOfficialColor];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];

弹出视图时:

ABPeoplePickerNavigationController *contactsPicker = [[ABPeoplePickerNavigationController alloc] init];
    contactsPicker.peoplePickerDelegate = self;
    contactsPicker.displayedProperties = @[[NSNumber numberWithInt:kABPersonPhoneProperty]];

    [contactsPicker.searchDisplayController.searchBar setBarTintColor:OrangeOfficialColor];
    [contactsPicker.searchDisplayController.searchBar setTintColor:[UIColor whiteColor]];

    [self presentViewController:contactsPicker animated:YES completion:nil];
  1. 查看还可以: enter image description here

  2. 查看不正常: enter image description here

  3. 查看不正常: enter image description here

1 个答案:

答案 0 :(得分:0)

一旦我开始使用Xcode 6(iOS 8 SDK)和iOS 7应用程序,我就遇到了同样的问题。这是我的解决方法:

[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes:@{NSFontAttributeName : [UIFont fontWithName:@"HelveticaNeue" size:16.0f], NSForegroundColorAttributeName : [UIColor blueColor]} forState:UIControlStateNormal];