没有导航控制器的通知操作打开视图 [英] Notification action open view without Navigation Controller

查看:19
本文介绍了没有导航控制器的通知操作打开视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个应用程序,它可以从推送通知中打开详细信息视图.在我的 AppDelegate 中,我打开了视图,但该视图没有导航控制器.

I'm doing an app which opens a detail view from a push notification. In my AppDelegate I'm opening the view, but the view doesn't have a navigation controller.

然后我认为我的解决方案是使用方法 instantiateViewControllerWithIdentifier处理导航控制器,我不确定这是否是解决方案,但这是标题的问题...

Then I think that my solution is use the method instantiateViewControllerWithIdentifier to handle the navigation controller, I'm not sure if this is the solution, but here is the question of the title...

我的类SlideNavigationController是Objective-C,当我使用该方法时

My class SlideNavigationController is Objective-C, and when I use the method

let rootVC = UIStoryboard(name: "Main", bundle: nil).
instantiateViewControllerWithIdentifier("SlideNavigationController") as! SlideNavigationController

我收到错误:

警告:无法加载任何 Objective-C 类信息.这将显着降低可用类型信息的质量.

warning: could not load any Objective-C class information. This will significantly reduce the quality of type information available.

有什么想法吗?抱歉我的英语,欢迎编辑!谢谢

Any idea? Sorry for my English, edits are welcome! Thanks

我的 UIController 的问题解决了.这是我的代码:

The problem with my UIController is solved. Here is my code:

           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)

希望对你有所帮助.

这篇关于没有导航控制器的通知操作打开视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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