ios - 没有导航 Controller 的通知操作打开 View

标签 ios objective-c swift uiviewcontroller uinavigationcontroller

我正在开发一个从推送通知打开详细 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/

相关文章:

ios - 如何实现室内导航的 SteerPath SDK 实现

ios - 获取保存到相册的图片文件名

ios - UIIView 到 CGContext 横向坐标系

objective-c - 为什么我在将多个 QTCaptureVideoPreviewOutputs 与单个 QTCaptureSession 一起使用时会遇到低帧率?

iOS - 在输入过程中验证用户 ip 地址

swift - 如何将数据从 View Controller 传递到模型?

swift - 下标使用不明确(Swift 3)

ios - 如何在 firebase 中管理用户的不同身份验证

ios - UILabel 无法像在 Interface Builder 中那样在 Emulator 和真实设备中正确显示文本

objective-c - 从该类中调用类方法