• APP快速搭建框架


    AppDelegate:

     1 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
     2     // Override point for customization after application launch.
     3     //1.创建窗口
     4     self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
     5     //设置窗口的根控制器
     6     CYXTabBarController *tabBarVC = [[CYXTabBarController alloc]init];
     7     self.window.rootViewController = tabBarVC;
     8     //3.显示窗口
     9     [self.window makeKeyAndVisible];
    10     return YES;
    11 }

    CYXTabBarController:

    @interface CYXTabBarController : UITabBarController

     1 - (void)viewDidLoad {
     2     [super viewDidLoad];
     3     // Do any additional setup after loading the view.VC
     4     
     5     //添加第一个控制器
     6     //1.1 初始化
     7     CYXOneViewController *oneVC = [[CYXOneViewController alloc]init];
     8     //1.2 把oneVC添加为UINavigationController的根控制器
     9     UINavigationController *nav1 = [[UINavigationController alloc]initWithRootViewController:oneVC];
    10     //设置tabBar的标题
    11     nav1.title = @"首页";
    12     //设置导航栏背景颜色
    13     nav1.navigationBar.barTintColor = [UIColor yellowColor];
    14     //设置tabBar的图标
    15     nav1.tabBarItem.image = [UIImage imageNamed:@"icon_tabbar_merchant_normal"];
    16     //设置navigationBar的标题
    17     oneVC.navigationItem.title = @"这是导航栏标题1";
    18     //设置背景色
    19     oneVC.view.backgroundColor = [UIColor whiteColor];
    20     //1.3 把UINavigationController交给UITabBarController管理
    21     [self addChildViewController:nav1];
    22     
    23     //添加第二个控制器
    24     CYXTwoViewController *twoVC = [[CYXTwoViewController alloc]init];
    25     UINavigationController *nav2 = [[UINavigationController alloc]initWithRootViewController:twoVC];
    26     nav2.title = @"我的";
    27     //设置导航栏背景图片
    28     //[nav2.navigationBar setBackgroundImage:[UIImage imageNamed:@""] forBarMetrics:UIBarMetricsDefault];
    29     nav2.tabBarItem.image = [UIImage imageNamed:@"icon_tabbar_mine"];
    30     twoVC.navigationItem.title = @"这是导航栏标题2";
    31     twoVC.view.backgroundColor = [UIColor whiteColor];
    32     [self addChildViewController:nav2];
    33     
    34     //添加第三个控制器
    35     CYXThreeViewController *threeVC = [[CYXThreeViewController alloc]init];
    36     UINavigationController *nav3 = [[UINavigationController alloc]initWithRootViewController:threeVC];
    37     nav3.title = @"开门";
    38     nav3.tabBarItem.image = [UIImage imageNamed:@"icon_tabbar_onsite"];
    39     threeVC.navigationItem.title = @"这是导航栏标题3";
    40     threeVC.view.backgroundColor = [UIColor whiteColor];
    41     [self addChildViewController:nav3];
    42     
    43     //添加第四个控制器
    44     CYXFourViewController *fourVC = [[CYXFourViewController alloc]init];
    45     UINavigationController *nav4 = [[UINavigationController alloc]initWithRootViewController:fourVC];
    46     nav4.title = @"更多";
    47     nav4.tabBarItem.image = [UIImage imageNamed:@"icon_tabbar_misc"];
    48     fourVC.navigationItem.title = @"这是导航栏标题4";
    49     fourVC.view.backgroundColor = [UIColor whiteColor];
    50     [self addChildViewController:nav4];
    51 }

     github address:https://github.com/AbelSu131/ZhuLiu

  • 相关阅读:
    Windows Phone 7 问答(答案部分)
    Windows Phone 7 添加按钮的VSM状态分组
    Windows Phone 实用开发技巧(2):使用TombstoneHelper简化墓碑操作
    浅谈ListBox在Windows Phone 7 中的使用(2)
    Windows Phone 实用开发技巧(8):在Windows Phone显示GIF图片
    Windows Phone实用开发技巧(1):保存图片及加载图片
    Windows Phone 7 Tips (5)
    升级Windows Phone 开发环境
    Windows Phone 实用开发技巧(10):Windows Phone 中处理图片的技巧
    Windows Phone 中的弹出窗口
  • 原文地址:https://www.cnblogs.com/abelsu/p/4814110.html
Copyright © 2020-2023  润新知