我正在开发一个从推送通知打开详细 View 的应用程序。 在我的 AppDelegate 中,我正在打开 View ,但该 View 没有导航 Controller 。
然后我认为我的解决方案是使用方法 instantiateViewControllerWithIdentifier
处理导航 Controller ,我不确定这是否是解决方案,但这是标题的问题...
我的类SlideNavigationController
是Objective-C的,当我使用该方法时
let rootVC = UIStoryboard(name: "Main", bundle: nil).
instantiateViewControllerWithIdentifier("SlideNavigationController") as! SlideNavigationController
我得到错误:
warning: could not load any Objective-C class information. This will significantly reduce the quality of type information available.
有什么想法吗?对不起我的英语,欢迎编辑!谢谢
我的 UIController 的问题已经解决了。这是我的代码:
let rootViewController = self.window!.rootViewController as! UINavigationController
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let targerView = mainStoryboard.instantiateViewControllerWithIdentifier("view_place_detail") as! VCPlaceDetailTour
targerView.placeId = aps as String
rootViewController.pushViewController(targerView, animated: false)
最佳答案
您可以使用这段代码。
let rootViewController = self.window!.rootViewController as! UINavigationController
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let targerView = mainStoryboard.instantiateViewControllerWithIdentifier("view Identifier") as! PromotionDetailsVC
rootViewController.pushViewController(targerView, animated: false)
希望对您有所帮助。
关于ios - 没有导航 Controller 的通知操作打开 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37859446/