<small id='wSjlo'></small><noframes id='wSjlo'>

      <tfoot id='wSjlo'></tfoot>
    1. <i id='wSjlo'><tr id='wSjlo'><dt id='wSjlo'><q id='wSjlo'><span id='wSjlo'><b id='wSjlo'><form id='wSjlo'><ins id='wSjlo'></ins><ul id='wSjlo'></ul><sub id='wSjlo'></sub></form><legend id='wSjlo'></legend><bdo id='wSjlo'><pre id='wSjlo'><center id='wSjlo'></center></pre></bdo></b><th id='wSjlo'></th></span></q></dt></tr></i><div id='wSjlo'><tfoot id='wSjlo'></tfoot><dl id='wSjlo'><fieldset id='wSjlo'></fieldset></dl></div>
        <bdo id='wSjlo'></bdo><ul id='wSjlo'></ul>
    2. <legend id='wSjlo'><style id='wSjlo'><dir id='wSjlo'><q id='wSjlo'></q></dir></style></legend>

      在 Appdelegate 的 Storyboard 中以编程方式为 UINavigationcontroller 设置

      时间:2023-06-11
      <legend id='jyOLw'><style id='jyOLw'><dir id='jyOLw'><q id='jyOLw'></q></dir></style></legend>
      1. <i id='jyOLw'><tr id='jyOLw'><dt id='jyOLw'><q id='jyOLw'><span id='jyOLw'><b id='jyOLw'><form id='jyOLw'><ins id='jyOLw'></ins><ul id='jyOLw'></ul><sub id='jyOLw'></sub></form><legend id='jyOLw'></legend><bdo id='jyOLw'><pre id='jyOLw'><center id='jyOLw'></center></pre></bdo></b><th id='jyOLw'></th></span></q></dt></tr></i><div id='jyOLw'><tfoot id='jyOLw'></tfoot><dl id='jyOLw'><fieldset id='jyOLw'></fieldset></dl></div>

        <small id='jyOLw'></small><noframes id='jyOLw'>

            <tbody id='jyOLw'></tbody>
          • <bdo id='jyOLw'></bdo><ul id='jyOLw'></ul>

                <tfoot id='jyOLw'></tfoot>
                本文介绍了在 Appdelegate 的 Storyboard 中以编程方式为 UINavigationcontroller 设置 rootViewcontroller的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我在 NSUserdefaults 中有一个值.我正在使用 storyboard,它嵌入在 UINavigationController 中.

                I have a value in NSUserdefaults. I am using storyboard, it is embedded in UINavigationController.

                - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
                {
                     if([[NSUserDefaults standardUserDefaults]objectForKey:@"isLoggedIn"]){
                         //show home page here
                        }else{
                           // show login view
                        }
                }
                

                我也可以使用 URL 打开应用程序

                I can open the app using a URL also

                - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
                         NSString *text = [[url host] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
                
                         if(text.length > 0){
                           // show home page 
                
                         }else {
                          // show settings page
                        }
                
                        return YES;
                }
                

                如何根据检索到的值为 UINavigationController 设置 rootViewController.有人可以帮我吗?

                How can I set the rootViewController for the UINavigationController based on the value that is retrieved .Can anyone please help me out?

                推荐答案

                您可以根据if/else条件使用您的ViewController创建一个UINavigationController对象,并在AppDelegate中将导航控制器设置为window的rootViewController属性,如下所示:

                You can create an object of UINavigationController with your ViewController as per if/else condition and set the navigation controller as rootViewController property of window in AppDelegate as follows:

                LoginViewController *loginController = [[UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil] instantiateViewControllerWithIdentifier:@"loginController"]; //or the homeController
                UINavigationController *navController = [[UINavigationController alloc]initWithRootViewController:loginController];
                self.window.rootViewController = navController;
                

                这篇关于在 Appdelegate 的 Storyboard 中以编程方式为 UINavigationcontroller 设置 rootViewcontroller的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:继承 UINavigationController 的步骤 下一篇:UINavigationController 后退按钮不可见,但有效

                相关文章

                1. <legend id='s7We0'><style id='s7We0'><dir id='s7We0'><q id='s7We0'></q></dir></style></legend>

                  1. <tfoot id='s7We0'></tfoot>
                    • <bdo id='s7We0'></bdo><ul id='s7We0'></ul>
                  2. <i id='s7We0'><tr id='s7We0'><dt id='s7We0'><q id='s7We0'><span id='s7We0'><b id='s7We0'><form id='s7We0'><ins id='s7We0'></ins><ul id='s7We0'></ul><sub id='s7We0'></sub></form><legend id='s7We0'></legend><bdo id='s7We0'><pre id='s7We0'><center id='s7We0'></center></pre></bdo></b><th id='s7We0'></th></span></q></dt></tr></i><div id='s7We0'><tfoot id='s7We0'></tfoot><dl id='s7We0'><fieldset id='s7We0'></fieldset></dl></div>

                    <small id='s7We0'></small><noframes id='s7We0'>