zoukankan      html  css  js  c++  java
  • UINavigationController和UITabBarController共存的例子

    1. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions  
    2. {  
    3.     FirstViewController *firstViewController=[[FirstViewController alloc]initWithNibName:@"FirstViewController" bundle:nil];  
    4.     UINavigationController *navControl1=[[UINavigationController alloc]initWithRootViewController:firstViewController];  
    5.     [firstViewController release];  
    6.       
    7.     SecondViewController *secondViewController=[[SecondViewController alloc]initWithNibName:@"SecondViewController" bundle:nil];  
    8.     UINavigationController *navControl2=[[UINavigationController alloc]initWithRootViewController:secondViewController];  
    9.     [secondViewController release];  
    10.       
    11.     self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];  
    12.   
    13.     self.tabBarController = [[[UITabBarController alloc] init] autorelease];  
    14.     self.tabBarController.viewControllers = [NSArray arrayWithObjects:navControl1, navControl2, nil];  
    15.       
    16.     [navControl1 release];  
    17.     [navControl2 release];  
    18.     self.window.rootViewController = self.tabBarController;  
    19.   
    20.     [self.window makeKeyAndVisible];  
    21.     return YES;  
    22. }  


    如果某个tabBar不需要navigation,那么用如下代码初始化对应的control

    1. UIViewController *viewController2 = [[[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil] autorelease]; 
  • 相关阅读:
    NET Office 组件Spire
    Tasks.Parallel
    vue 2.0-1
    ESLint 检查代码质量
    找到 OSChina 早上 8 点钟容易宕机的原因 ?
    MySQL索引 专题
    SqlMapConfig.xml全局配置文件解析
    mybatis mapper namespace
    resultMap之collection聚集
    Uploadify 控件上传图片 + 预览
  • 原文地址:https://www.cnblogs.com/xukunhenwuliao/p/3576213.html
Copyright © 2011-2022 走看看