zoukankan      html  css  js  c++  java
  • 导航视图(四)

    导航视图

    1、创建导航视图根视图:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        
        self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen] bounds]];
        
        ViewController* viewController = [[ViewController alloc]
                                              initWithNibName:@"ViewController" bundle:nil];
        
        self.navigationController = [[UINavigationController alloc]
                                     initWithRootViewController:viewController];
        
        self.window.rootViewController = self.navigationController;
        [self.window makeKeyAndVisible];
        
        return YES;
    }

    2、跳转到新视图控制器:

    SecondViewController* secondView = [[SecondViewController alloc]
                                          initWithNibName:@"SecondViewController" bundle:nil];
        
        [self.navigationController pushViewController:secondView animated:nil];

    3、返回之前的视图控制器:

        //回到上一级视图
    //    [self.navigationController popViewControllerAnimated:YES];
        
        //回到根视图
    //    [self.navigationController popToRootViewControllerAnimated:YES];
        
        //回到指定视图
        NSArray * ctrlArray = self.navigationController.viewControllers;
        [self.navigationController popToViewController:[ctrlArray objectAtIndex:0] animated:YES];

    备注:这里各个压入堆栈中的ViewController 都采用self.navigationController获取导航控制器。可参考下文:

    http://kingbinchow.iteye.com/blog/1990807

  • 相关阅读:
    Exploits Likely Leveraged by Russia’s APT28 in Highly-Targeted Attack
    WAF绕过的一些总结和思考
    PHP SAFE MODE BYPASS
    RAS算法原理
    如何绕过WAF
    360手机助手关于签名校验的分析
    cat 命令详解
    面向对象简介
    APK签名及简单反编译
    面向对象之基本概念 封装、单多继承
  • 原文地址:https://www.cnblogs.com/Fredric-2013/p/5966707.html
Copyright © 2011-2022 走看看