zoukankan      html  css  js  c++  java
  • IOS开发之UITabBarController与UINavigationController混合使用

    ios开发中UITabBarController与UINavigationController混合使用是很多app的基础页面结构,下面是简单的的页面初始化的方法,在AppDelegate.m的

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    

      中加入如下代码

       self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        self.window.backgroundColor = [UIColor whiteColor];
        [self.window makeKeyAndVisible];
        //初始化tabbar并设置为根视图
        tabBarViewController = [[UITabBarController alloc]init];
        [self.window setRootViewController:tabBarViewController];
        
        //初始化视图并注入tabbar作为子视图
        MainViewController* first = [[MainViewController alloc]init];
        first.title = @"首页";
        first.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"首页" image:[UIImage imageNamed:@"singleicon.png"]  selectedImage:[UIImage imageNamed:@"singleicon.png"] ];
        //初始化navigation并把navigation加入到tabbar中
        UINavigationController * navFirst = [[UINavigationController alloc]initWithRootViewController:first];
        [tabBarViewController addChildViewController:navFirst];
        
        
        BobMyInfoTableViewController* second = [[BobMyInfoTableViewController alloc]init];
        second.title = @"我的信息";
        second.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"" image:[UIImage imageNamed:@"doubleicon.png"] selectedImage:[UIImage imageNamed:@"doubleicon.png"]];
         UINavigationController * navSec = [[UINavigationController alloc]initWithRootViewController:second];
        [tabBarViewController addChildViewController:navSec];

    有错误欢迎指正。Stay Hungry Stay Foolish

  • 相关阅读:
    MySQL-LSN
    MySQL Binlog三种格式介绍及分析
    MySQL中的seconds_behind_master的理解
    MySQL的四种事务隔离级别
    pt-table-sync修复mysql主从不一致的数据
    MySQL主从不同步、数据不一致解决办法
    nginx的应用【静态代理、动静分离】
    Redis数据缓存淘汰策略【FIFO 、LRU、LFU】
    Java基本知识点o(1), o(n), o(logn), o(nlogn)的了解
    JS函数篇【2】
  • 原文地址:https://www.cnblogs.com/spongebob/p/6653988.html
Copyright © 2011-2022 走看看