ios - CNContactViewController 隐藏导航栏

标签 ios objective-c ios10 cncontactviewcontroller

当我将 CNContactViewController 插入 UINavigationController 中的 UITableViewController 子类的堆栈时,顶部导航栏几乎完全隐藏.但是随着亮度一直调高,你可以看到后退箭头后面跟着“详细信息”这个词,还有系统状态栏。当我点击屏幕的那个角落时,CNContactViewController 确实被关闭了。

enter image description here

当然这不好,因为用户可能甚至看不到导航栏的文本而现在按下任何按钮将其关闭。

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

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 以下的版本。当我点击“添加到现有联系人”时,我也确实得到了正确着色的导航栏,但当该 View 时它再次中断 Controller 被解雇。

enter image description here

再一次,我的问题是:有什么方法可以使 CNContactViewController 的导航栏色调与显示它的 View Controller (我的应用程序的其余部分)相同?

最佳答案

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

您不能直接对 bar 色调做任何事情,但您可以通过以下两种方式之一解决此问题:

  • 一种方法是让您的导航栏不透明。在这种情况下,联系人 View Controller 的导航栏将为黑色,而您的白色栏按钮项目将可见。

  • 另一种方法是在接触 View Controller 按下时更改导航栏的色调(不是栏色调,而是它传达给其栏按钮项目的色调),并在它按下时将其改回流行音乐。

编辑 好的,我发现还有一个问题,因为 New Contact View Controller 是呈现在您面前的另一个 View Controller 。如果你拒绝放弃你的白色条形按钮项目设置,你将不得不使用外观代理在你按下接触 View Controller 时将 UIBarButtonItem 色调颜色设置为其他颜色,然后在你的导航 Controller 时将其重置回你的白色委托(delegate)告诉您用户正在弹出回到您的 View Controller 。

关于ios - CNContactViewController 隐藏导航栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40600559/

相关文章:

ios - 如何在iOS 10中删除贴纸包

iOS10 WkWebView 数据 URL 解码失败

ios - 检索 UIPreviewInteraction 关联的触摸

iphone - CABasicAnimation 在动画完成后不更改其位置属性

ios - 如何在 ios swift 中添加彩色图标?

iphone - 如何在iOS中的UIGestureRecognizer中匹配图像形状?

ios - MPNowPlayingInfoCenter Remote 在 iOS 10 中响应不正确

ios - 在后台 iOS 中接收推送通知

objective-c - 如何将 nsstring 转换为 nsdictionary?

ios - 如何使用 Objective C 将 UIObjects 从一个类重用到多个类?