我正在尝试使用内置的新联系人用户界面,但在使用取消按钮时出现意外行为。下面的代码可以调用新的联系人屏幕,但取消按钮只会清除屏幕条目,不会取消新的联系人屏幕。在内置的联系人应用程序中,点击取消返回到联系人列表屏幕。我想要取消按钮关闭窗口。
@IBAction func newTwo(sender: AnyObject) {
AppDelegate.getAppDelegate().requestForAccess { (accessGranted) -> Void in
if accessGranted {
let npvc = CNContactViewController(forNewContact: nil)
npvc.delegate = self
self.navigationController?.pushViewController(npvc, animated: true)
}
}
}
最佳答案
您是否实现了 CNContactViewControllerDelegate 方法? 这是 a link to documentation
例如:
func contactViewController(viewController: CNContactViewController, didCompleteWithContact contact: CNContact?) {
self.dismissViewControllerAnimated(true, completion: nil)
}
关于ios - CNContactViewController 取消按钮不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36073064/