• 03-UITabBarController简单使用


    //
    //  AppDelegate.m
    //  09-UITabBarController简单使用
    #import "AppDelegate.h"
    
    @interface AppDelegate ()
    
    @end
    
    @implementation AppDelegate
    
    
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        // Override point for customization after application launch.
        
        // 创建窗口
        self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
        
        // 设置窗口的跟控制器
        UITabBarController *tabBarVc = [[UITabBarController alloc] init];
        
        self.window.rootViewController = tabBarVc;
        
        UIViewController *vc = [[UIViewController alloc] init];
        
        vc.view.backgroundColor = [UIColor redColor];
        
        // 添加子控制器
        [tabBarVc addChildViewController:vc];
        
        //  设置按钮上面的内容
        vc.tabBarItem.title = @"消息";
        vc.tabBarItem.image = [UIImage imageNamed:@"tab_recent_nor"];
        vc.tabBarItem.badgeValue = @"1000";
        
        UIViewController *vc1 = [[UIViewController alloc] init];
        
        vc1.view.backgroundColor = [UIColor greenColor];
        
        // 添加子控制器
        [tabBarVc addChildViewController:vc1];
    
        vc1.tabBarItem.title = @"联系人";
        vc1.tabBarItem.badgeValue = @"10";
        // 显示窗口
        [self.window makeKeyAndVisible];
        
        
        return YES;
    }
    
    - (void)applicationWillResignActive:(UIApplication *)application {
        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
        // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
    }
    
    - (void)applicationDidEnterBackground:(UIApplication *)application {
        // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
        // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
    }
    
    - (void)applicationWillEnterForeground:(UIApplication *)application {
        // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
    }
    
    - (void)applicationDidBecomeActive:(UIApplication *)application {
        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    }
    
    - (void)applicationWillTerminate:(UIApplication *)application {
        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
    }
    
    @end
    本人无商业用途,仅仅是学习做个笔记,特别鸣谢小马哥,学习了IOS,另日语学习内容有需要文本和音频请关注公众号:riyuxuexishuji
  • 相关阅读:
    shell之ping减少时间间隔&ping的次数&用IP1去ping IP2的技巧
    kali界面乱码解决方案记录
    win10子系统kali-linux安装图形化界面总结
    树莓派4 64bit 编译安装QT5.13.2 和 Redis Desktop Manager 2020.1-dev
    树莓派4 (8GB) RaspiOS 64 bit 入手配置流程 2020-06-10
    阿里巴巴Java开发手册(泰山版)个人阅读精简
    Java 8 新API Steam 流 学习笔记
    IDEA中maven项目部署到云服务器上(简易)
    收藏模块的设计
    js常用代码片段(更新中)
  • 原文地址:https://www.cnblogs.com/laugh/p/6654778.html
Copyright © 2020-2023  润新知