我正在尝试使用内置的新联系人 UI,但使用取消按钮时出现意外行为。下面的代码可以运行并调用新的联系人屏幕,但取消按钮只会清除屏幕条目,而不会从新的联系人屏幕中取消。在内置联系人应用程序中,点击取消将返回到联系人列表屏幕。我想要取消按钮来关闭窗口。
@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 方法吗?
这是文档链接 https://developer.apple.com/library/prerelease/ios/documentation/ContactsUI/Reference/CNContactViewControllerDelegate_Protocol/index.html
例如:
func contactViewController(viewController: CNContactViewController, didCompleteWithContact contact: CNContact?) {
self.dismissViewControllerAnimated(true, completion: nil)
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)