无法关闭CNContactViewController [英] Unable to dismiss CNContactViewController

查看:150
本文介绍了无法关闭CNContactViewController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试让用户创建一个新的联系人.当我得到提示用户输入所有详细信息的屏幕时,顶部没有导航栏(例如默认的Apple Contacts应用程序中有导航栏).无法退出现场.我在swift 2.0和Xcode 7.3中使用ContactUI框架.这是代码:

I'm trying to let the user create a new contact. While I've got the screen to prompt the user to put in all his details there is no navigation bar at the top(Like there is in the default Apple Contacts app). There is no way to exit the scene. I'm using the ContactUI framework in swift 2.0 and Xcode 7.3. Here's the code:

// 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

Here's what I'm trying to get: Apple Default

这是我所拥有的: 我有什么

我正在从选项卡视图控制器中的操作表启动新的联系人视图控制器.我尝试将选项卡嵌入到导航视图控制器中,但没有任何效果.我什至尝试设置navController的setToolbarHidden属性,但没有帮助.

I'm launching the new contact view controller from an action sheet in a tab view controller. I tried embedding the tab in a Navigation view controller but to no effect. I even tried setting the setToolbarHidden property of the navController but it didn't help.

感谢您的帮助.我在其他论坛上看到了这个问题,但是他们没有帮助.

Thanks for any help. I saw the issue raised in other forums but they didn't help.

推荐答案

视图控制器必须嵌入UINavigationController中,并且您应该推送或显示视图控制器:

The view controllers must be embedded in UINavigationController and you should push or show view controller:

navigationController?.pushViewController(contactPicker, animated: true)

代替展示视图控制器

这篇关于无法关闭CNContactViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆