我有图 1 中显示的主视图控制器。
当用户单击条形按钮时,使用presentViewController:
方法呈现另一个视图控制器。这CNContactPickerViewController
是完全原生的(如图 2 所示)。
如何更改此控制器的 UINavigationBar 的颜色?我尝试了以下方法但没有奏效:
- 更改 Appdelegate 中的导航栏颜色
- 更改了控制器继承的全局文件中的导航栏颜色。
我使用了以下代码:
[self.navigationBar setTranslucent:NO];
[self.navigationBar setBackgroundImage:[UIImage imageNamed:@"NavigationBarBackground"]
forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault];
[self.navigationBar setShadowImage:[UIImage new]];
[self.navigationBar setTintColor:kBlackColor];
[[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
[UIColor blackColor], NSForegroundColorAttributeName,nil]];
此外,当我在设备 iPhone 6S iOS 9.3.2 上运行应用程序时,CNContactPickerViewController 不会在导航栏上显示组按钮,如模拟器所示。
如何改变颜色Cancel button on CNContactPickerViewController
?
上面的问题我已经有了答案。现在,悬而未决的事情是如何更改 tableview部分的颜色以及CNContactPickerViewController
.