- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我正在尝试让用户创建一个新联系人。虽然我有屏幕提示用户输入他的所有详细信息,但顶部没有导航栏(就像默认的 Apple Contacts 应用程序中一样)。没有办法退出现场。我在 swift 2.0 和 Xcode 7.3 中使用 ContactUI 框架。这是代码:
// create a new contact
let createNewActionHandler = {(action: UIAlertAction) -> Void in
let newContact = CNMutableContact()
let contactPicker = CNContactViewController(forNewContact: newContact)
contactPicker.delegate = self
contactPicker.navigationController?.setToolbarHidden(false, animated: false)
self.presentViewController(contactPicker, animated: true, completion: nil)
}
这是我想要得到的: Apple Default
这是我拥有的: What I have
我正在从选项卡 View Controller 中的操作表启动新的联系人 View Controller 。我尝试将选项卡嵌入导航 View Controller 中,但没有效果。我什至尝试设置 navController 的 setToolbarHidden 属性,但没有帮助。
感谢您的帮助。我在其他论坛上看到了这个问题,但他们没有帮助。
最佳答案
您必须将 contactViewController 嵌入到 UINavigationController和实现委托(delegate)方法。
let createNewActionHandler = {(action: UIAlertAction) -> Void in
let newContact = CNMutableContact()
let contactPicker = CNContactViewController(forNewContact: newContact)
contactPicker.delegate = self
let navigation = UINavigationController(rootViewController: contactPicker)
self.presentViewController(navigation, animated: true, completion: nil)
}
//MARK: - Delegate
func contactViewController(viewController: CNContactViewController, didCompleteWithContact contact: CNContact?) {
viewController.dismissViewControllerAnimated(true, completion: nil)
}
func contactViewController(viewController: CNContactViewController, shouldPerformDefaultActionForContactProperty property: CNContactProperty) -> Bool {
return true
}
关于ios - 无法关闭 CNContactViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37390406/
当用户成功保存或关闭CNContactViewController时如何获取回调 func addContact(contactDetails: ContactDetails) { let s
我正在尝试在我的应用程序中实现 UIKeyCommand 快捷方式,并且在大多数情况下,它似乎工作正常。除了当我在模态视图中呈现 CNContactViewController 时,它似乎做了一些奇怪
当我打开CNContactViewController时,它会打开没有取消和完成按钮的 View 。此问题仅出现在iOS13及更高版本中。 如何更改栏按钮颜色? 我尝试了此链接,但它不起作用 Chan
我目前正在开发一个 Swift 应用程序,我希望用户能够编辑他们之前在该应用程序中创建的联系人。也就是说,我正在使用 CNContactViewController(forContact: CNCon
当我将 CNContactViewController 插入 UINavigationController 中的 UITableViewController 子类的堆栈时,顶部导航栏几乎完全隐藏.但是
我正在尝试使用内置的新联系人用户界面,但在使用取消按钮时出现意外行为。下面的代码可以调用新的联系人屏幕,但取消按钮只会清除屏幕条目,不会取消新的联系人屏幕。在内置的联系人应用程序中,点击取消返回到联系
我正在尝试让用户创建一个新联系人。虽然我有屏幕提示用户输入他的所有详细信息,但顶部没有导航栏(就像默认的 Apple Contacts 应用程序中一样)。没有办法退出现场。我在 swift 2.0 和
我正在尝试实现 CNContactViewDelegate 以便能够显示 CNContact 的详细信息。显然,我是第一个使用 SwiftUI 实现它并遇到问题的人。无论如何,我可以通过使用 UIVi
我创建了新的 CNContactViewController 以在电话目录中添加新联系人,但是当我导航到 Controller 时,CNContactViewController 导航后退按钮被隐藏。
我的应用程序有一个本地联系人数据库,没有存储在内部联系人存储中(但是用户可以选择将联系人添加到内部联系人存储中) 我正在使用 CNContactViewController 来显示联系人的详细信息 -
我在我的应用程序中展示了一个 CNContactViewController 的实例。我希望用户既能编辑联系人,又能关闭这个 View Controller 。下面是呈现 View Controlle
我正在使用 CNContactViewController。但是,我想添加一个新按钮。我该怎么做 如果你不能添加一个新的按钮,那么我如何获得调用按钮的 Action ? 最佳答案 你能试试这样吗,但我
我想为 CNContactViewController 创建自定义 UINavigationBar 以便选择单个或多个联系人。默认的 UINavigationBar 由 Cancel、Done 和 G
这不是 this question 的骗局或 this question因为这些答案没有用。 出于某种原因,在 UINavigationController 中呈现 CNContactViewCont
我想使用 contactsUI CNContactViewController.init(forNewContact: a) 仅用于查看并将值传递给服务器。但是,现在该功能还在地址簿/联系人应用程序中
我正在尝试打开 CNContactViewController 以从 NavigationView 创建新联系人。到目前为止,这是我尝试过但失败了的: 添加导航栏项并设置目的地 .na
点击添加照片后 观察滑下 Controller cancel时,newcontact和done消失。 var contact = new CNMutableContact {
我有一个任务是在他出现的时候(比如WhatsApp)立刻显示联系人编辑界面,我用下面的方式显示给他。 @objc private func presentContactEditControlle
我如何在 CNContactViewController(forUnknownContact:) 中获取图像 我试过这样的: fileprivate func showUnknownConta
尝试在给定的 tableView 中显示带有预建 UI 的联系人,当用户选择要显示的联系人时出现以下错误: CNPropertyNotFetchedException', reason: 'Conta
我是一名优秀的程序员,十分优秀!