CNContactViewController for unknowncontact 点击“添加到现有联系人”会显示一个 View Controller 。当用户选择取消时 CNContactViewController 的导航栏消失,现在无法返回。
最佳答案
可能有更好的方法来解决这个问题,但这对我有用。通过将我的 CNContactViewController 实例的导航栏的左侧栏按钮项设置为取消呈现的 CNContactViewController 的取消按钮的新实例来修复。在代码中:
let contactVC = CNContactViewController(forUnknownContact: newContact)
contactVC.navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel,
target: self, action: #selector(cancelAction))
然后我调用present并传入contactVC。然后在cancelAction中我调用了dismiss函数并且它起作用了!
关于ios - 导航栏在取消 "Add to Exsting Contact" Controller 时消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34605594/