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

  • 相关阅读:
    ROXFiler 2.6
    ubuntu下lxr的运用
    NTFS3G-Linux 的 NTFS 驱动步骤
    Songbird 0.2.5 Final
    ePDFView:一个轻量的 PDF 文档阅读东西
    Gmail Notifier:又一个 Gmail 邮件通知法式
    Hybrid Share-文件分享软件
    Dolphin:KDE 中的文件管理器
    文泉驿点阵宋体 0.8(嬴政)正式公布
    KDE 4 Kludge 发布宣布
  • 原文地址:https://www.cnblogs.com/Fredric-2013/p/5966707.html
Copyright © 2011-2022 走看看