• 导航视图(三)


    tab导航方式代码示例。

    #import "AppDelegate.h"
    #import "Tab1ViewController.h"
    #import "Tab2ViewController.h"
    #import "Tab3ViewController.h"
    
    @interface AppDelegate ()
    
    @end
    
    @implementation AppDelegate
    
    
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        
        
        self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
        
        UITabBarController *tabBarController = [[UITabBarController alloc] init];
        self.window.rootViewController = tabBarController;
        
        
        Tab1ViewController *tab1 = [[Tab1ViewController alloc]init];
        Tab2ViewController *tab2 = [[Tab2ViewController alloc]init];
        Tab3ViewController *tab3 = [[Tab3ViewController alloc]init];
        
        UINavigationController *nav1 = [[UINavigationController alloc]initWithRootViewController:tab1];
        UINavigationController *nav2 = [[UINavigationController alloc]initWithRootViewController:tab2];
        UINavigationController *nav3 = [[UINavigationController alloc]initWithRootViewController:tab3];
        
        nav1.title = @"Title1";
        nav2.title = @"Title2";
        nav3.title = @"Title3";
        
        nav1.tabBarItem.image = [UIImage imageNamed:@"btn_1_h"];
        nav2.tabBarItem.image = [UIImage imageNamed:@"btn_2_h"];
        nav3.tabBarItem.image = [UIImage imageNamed:@"btn_3_h"];
        
        
        NSArray *controllers = [NSArray arrayWithObjects: nav1, nav2, nav3, nil];
        
        tabBarController.viewControllers = controllers;
        
        self.window.backgroundColor = [UIColor whiteColor];
        [self.window makeKeyAndVisible];
        
        return YES;
    }
  • 相关阅读:
    .net core Docker 整套部署流程
    Mysql 关键字 ESCAPE
    ZJOI2022 题解
    多项式全家桶
    THUPC2022 游记
    FidderComposer(自定义请求)
    Postman使用详解
    FiddlerAutoResponder(自动响应器)
    Fiddler—工具栏
    Fiddler—过滤器(Filters)
  • 原文地址:https://www.cnblogs.com/Fredric-2013/p/5964468.html
Copyright © 2020-2023  润新知