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];
视图正常:
视图不正常:
视图不正常: