我在图像1中显示了家庭视图控制器。
当用户点击栏按钮时,会使用presentViewController:
方法显示另一个视图控制器。这是CNContactPickerViewController
,完全是原生的(如图2所示)。
如何更改此控制器的UINavigationBar的颜色? 我尝试过以下方法,但没有奏效:
我使用了以下代码:
[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
的颜色?
我已经回答了上述问题。现在,待处理的事情是如何更改CNContactPickerViewController
的tableview部分以及的颜色。
答案 0 :(得分:4)
最后,我在做了很多R& D之后得到了它。我使用下面的代码制作了 [[UINavigationBar appearance] setTranslucent:NO];
[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:213/255.0f green:38/255.0f blue:46/255.0f alpha:1.0]];
[[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor], NSForegroundColorAttributeName,nil]];
[[UINavigationBar appearance] setTintColor:kWhiteColor];
红色的导航栏。
{{1}}