我想在我的应用程序中添加3D触摸快速操作。我有两个viewContollers嵌入在navigationContoller中。当用户按下3D动作时,它应该将它们带到add事件viewController。但我得到这个错误3D触摸快速操作不会工作迅速3
could not cast value of type 'Morning_Star_2.AddEventsViewController' (0x1000a2260) to 'UINavigationController' (0x1a79cd360). 2017-05-02 02:51:36.220324-0400 Morning Star 2[3731:895126] Could not cast value of type 'Morning_Star_2.AddEventsViewController' (0x1000a2260) to 'UINavigationController' (0x1a79cd360).
这里是我的代码
func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) {
if shortcutItem.type == "com.krp.addEvent" {
let sb = UIStoryboard(name: "Main", bundle: nil)
let addEventVC = sb.instantiateViewController(withIdentifier: "addEventVC") as! UINavigationController
self.window?.rootViewController?.present(addEventVC, animated: true, completion: nil)
}
}
我试图改变的! UINavigationController为! AddEventsViewController。它可以工作,但是如果您正常打开应用程序,它将不会像我通常在添加viewController时那样在顶部显示导航栏。
您能不能告诉你的故事板的图片? –
它在那里@BhupatBheda。请点击“这是我的main.storyboard” –