1

I'm trying to change the color of the search bar orange and the bar tint color to white when a contact get selected.

不管我一直在尝试什么,什么都没有改变,它就像这样卡住了(后退按钮不是白色的)。

在 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. 视图正常: 在此处输入图像描述

  2. 视图不正常: 在此处输入图像描述

  3. 视图不正常: 在此处输入图像描述

4

1 回答 1

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];
于 2014-10-29T21:16:10.217 回答