OGeek|极客世界-中国程序员成长平台

标题: ios - 从推送通知 IOS 打开应用程序时打开特定的 ViewController [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 11:34
标题: ios - 从推送通知 IOS 打开应用程序时打开特定的 ViewController

我需要从推送通知中打开特定的 View Controller ; 这是我的 mainStoriboard:

MyStoryBoard

我能够到达 ViewController,但是当我在那里时,我看不到标签栏和导航 Controller 。 这里是代码:

@implementation AppDelegate


- (BOOL)applicationUIApplication *)application didFinishLaunchingWithOptionsNSDictionary *)launchOptions { 
if (launchOptions != nil)
{
        UIStoryboard*  sb = [UIStoryboard storyboardWithName"Main"
                                                      bundle:nil];
        UIViewController* vc = [sb instantiateViewControllerWithIdentifier"Table1"];

        self.window.rootViewController = vc;

}
return YES;

}

谁能帮帮我??



Best Answer-推荐答案


我认为您想在单击通知时“导航”到特定的 ViewController。如果这是正确的,那么您需要从根导航 Controller 到目标 View Controller ,因为您可能希望在检查它是否已经在堆栈上之后将最终 View Controller 推送到应用程序的当前导航堆栈上,如果它已经存在,你只需要更新它,否则推送那个 ViewController。

目前您的代码似乎只是让最终 View Controller 成为 Root View Controller ,这就是您看不到导航栏/标签栏的原因。

如果您需要代码方面的帮助,请告诉我,我会更新答案。 祝你好运

关于ios - 从推送通知 IOS 打开应用程序时打开特定的 ViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33255947/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4