CNContactViewController隐藏导航栏 [英] CNContactViewController hiding navigation bar

查看:456
本文介绍了CNContactViewController隐藏导航栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将 CNContactViewController 推送到 UITableViewController 的子堆栈时,该子类位于 UINavigationController ,顶部导航栏几乎完全隐藏。但是随着亮度一直向上,你会看到后面的箭头,然后是细节和系统状态栏。当我点击屏幕的那个角落时,CNContactViewController确实被解雇了。

When I push a CNContactViewController on to the stack of UITableViewController subclass which is within a UINavigationController, the top navigation bar is almost entirely hidden. But with the brightness all the way up, you make out the back arrow followed by the word "Detail", and the system status bar. When I tap that corner of the screen, the CNContactViewController is indeed dismissed.

当然这不好,因为用户可能甚至看不到导航栏的文本,现在按任何按钮即可解雇。

Of course this is not good, since a user would probably not even see the text of the navigation bar and now to press any buttons to dismiss.

有没有办法让CNContactViewController的导航栏色调与显示它的视图控制器(我应用程序的其余部分)相同?

CNContactViewController *controller = [CNContactViewController viewControllerForUnknownContact:person];

controller.contactStore = [[CNContactStore alloc] init];
controller.delegate = self;
controller.allowsActions = NO;

[self.navigationController pushViewController:controller animated:YES];

我应该注意到我在iOS 10上遇到这个问题,而不是10以下的版本。当我点击添加到现有联系人时,我也会得到正确着色的导航栏,但当该视图控制器被解除时,它会再次中断。

I should note that I'm only experiencing this problem on iOS 10, and not versions below 10. I also do get the properly tinted navigation bar when I tap "Add to Existing Contact", but it breaks again when that view controller is dismissed.

再次,我的问题是:有没有办法让CNContactViewController的导航栏色调与查看控制器显示它(我的应用程序的其余部分)?

推荐答案

您的第二个屏幕截图显示了此问题:您已将条形(或一般条形按钮项目)的色调颜色设置为白色。因此,它们在透明导航栏前面是白色的,在联系人视图控制器中是白色背景。

Your second screen shot shows the reason for this problem: you have set the tint color for your bar (or bar button items in general) to be white. Hence, they are white in front of the transparent navigation bar and white background in the contact view controller.

你不能直接对栏做任何事情色彩,但你可以通过两种方式解决这个问题:

You can't do anything directly about the bar tint color, but you can solve this in either of two ways:


  • 一种方法是让你的导航栏不透明。在这种情况下,联系人视图控制器的导航栏将为黑色,并且您的白色条形按钮项目将可见。

  • One is to make your navigation bar nontranslucent. In that case, the contact view controller's navigation bar will be black, and your white bar button items will be visible.

另一种方法是更改​​导航栏的当联系人视图控制器按下时,色调颜色(不是条纹色调,但是它传达到其条形按钮项目的色调颜色),并在弹出时将其更改回来。

Another approach is to change your navigation bar's tint color (not the bar tint color, but the tint color that it communicates down to its bar button items) as the contact view controller pushes, and change it back when it pops.

编辑好的,我看到还有一个问题,因为New Contact视图控制器是在你面前呈现的另一个视图控制器。如果您拒绝放弃白条按钮项目设置,则必须使用外观代理将UIBarButtonItem色调颜色设置为当您按下联系人视图控制器时的其他颜色,然后在导航控制器时将其重置为白色delegate告诉您用户正在弹回您的视图控制器。

EDIT Okay, I see that there's a further problem because the New Contact view controller is a further view controller presented in front of yours. If you refuse to give up your white bar button item setting, you will have to use the appearance proxy to set the UIBarButtonItem tint color to something else when your push the contact view controller, and then reset it back to your white when your navigation controller delegate tells you that the user is popping back to your view controller.

这篇关于CNContactViewController隐藏导航栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆