我想在我的應用程序中添加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」 –