UI04_標簽視圖控制器(17-08-08)

//
//  AppDelegate.m
//  UI04_標簽視圖控制器
//
//  Created by lanou3g on 17/8/8.
//  Copyright ? 2017年 lanou3g. All rights reserved.
//

#import "AppDelegate.h"
#import "FirstViewController.h"
#import "SecondViewController.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];
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    
    UITabBarController *tabBarController = [[UITabBarController alloc] init];
    FirstViewController *firstVIewController = [[FirstViewController alloc] init];
    SecondViewController *secondViewController = [[SecondViewController alloc] init];
    firstVIewController.title = @"First";
    secondViewController.title = @"Second";
    
    UIImage *image = [UIImage imageNamed:@"4-selected@2x.png"];
    
    UIImage *imageSelect = [UIImage imageNamed:@"4-nomal@2x.png"];
    imageSelect = [imageSelect imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    firstVIewController.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"首頁" image:image selectedImage:imageSelect];
    UIImage *image1 = [UIImage imageNamed:@"3-selected@2x.png"];
//    image1 = [image1 imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    UIImage *image1Select = [UIImage imageNamed:@"3-normal@2x.png"];
    image1Select = [image1Select imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    secondViewController.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Second" image:image1 selectedImage:image1Select];
    
    
    UINavigationController *firstNavigation = [[UINavigationController alloc] initWithRootViewController:firstVIewController];
    
    UINavigationController *secondtNavigation = [[UINavigationController alloc] initWithRootViewController:secondViewController];
    tabBarController.viewControllers = @[firstNavigation,secondtNavigation];
    self.window.rootViewController = tabBarController;
    
    //tabBar屬性
    tabBarController.tabBar.tintColor = [UIColor redColor];
//    tabBarController.tabBar.barTintColor = [UIColor yellowColor];
    //設(shè)置為不透明
    tabBarController.tabBar.translucent = NO;
    
    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

//
//  FirstViewController.m
//  UI04_標簽視圖控制器
//
//  Created by lanou3g on 17/8/8.
//  Copyright ? 2017年 lanou3g. All rights reserved.
//

#import "FirstViewController.h"

@interface FirstViewController ()

@end

@implementation FirstViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor orangeColor];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end

//
//  SecondViewController.m
//  UI04_標簽視圖控制器
//
//  Created by lanou3g on 17/8/8.
//  Copyright ? 2017年 lanou3g. All rights reserved.
//

#import "SecondViewController.h"

@interface SecondViewController ()

@end

@implementation SecondViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor blueColor];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末多矮,一起剝皮案震驚了整個濱河市艳狐,隨后出現(xiàn)的幾起案子备绽,更是在濱河造成了極大的恐慌注簿,老刑警劉巖宅广,帶你破解...
    沈念sama閱讀 212,222評論 6 493
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異,居然都是意外死亡,警方通過查閱死者的電腦和手機宠互,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,455評論 3 385
  • 文/潘曉璐 我一進店門味榛,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人予跌,你說我怎么就攤上這事搏色。” “怎么了券册?”我有些...
    開封第一講書人閱讀 157,720評論 0 348
  • 文/不壞的土叔 我叫張陵频轿,是天一觀的道長。 經(jīng)常有香客問我烁焙,道長略吨,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 56,568評論 1 284
  • 正文 為了忘掉前任考阱,我火速辦了婚禮,結(jié)果婚禮上鞠苟,老公的妹妹穿的比我還像新娘乞榨。我一直安慰自己,他們只是感情好当娱,可當我...
    茶點故事閱讀 65,696評論 6 386
  • 文/花漫 我一把揭開白布吃既。 她就那樣靜靜地躺著,像睡著了一般跨细。 火紅的嫁衣襯著肌膚如雪鹦倚。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 49,879評論 1 290
  • 那天冀惭,我揣著相機與錄音震叙,去河邊找鬼。 笑死散休,一個胖子當著我的面吹牛媒楼,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播戚丸,決...
    沈念sama閱讀 39,028評論 3 409
  • 文/蒼蘭香墨 我猛地睜開眼划址,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了限府?” 一聲冷哼從身側(cè)響起夺颤,我...
    開封第一講書人閱讀 37,773評論 0 268
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎胁勺,沒想到半個月后世澜,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 44,220評論 1 303
  • 正文 獨居荒郊野嶺守林人離奇死亡署穗,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 36,550評論 2 327
  • 正文 我和宋清朗相戀三年宜狐,在試婚紗的時候發(fā)現(xiàn)自己被綠了势告。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 38,697評論 1 341
  • 序言:一個原本活蹦亂跳的男人離奇死亡抚恒,死狀恐怖咱台,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情俭驮,我是刑警寧澤回溺,帶...
    沈念sama閱讀 34,360評論 4 332
  • 正文 年R本政府宣布,位于F島的核電站混萝,受9級特大地震影響遗遵,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜逸嘀,卻給世界環(huán)境...
    茶點故事閱讀 40,002評論 3 315
  • 文/蒙蒙 一车要、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧崭倘,春花似錦翼岁、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,782評論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至残家,卻和暖如春榆俺,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背坞淮。 一陣腳步聲響...
    開封第一講書人閱讀 32,010評論 1 266
  • 我被黑心中介騙來泰國打工茴晋, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人回窘。 一個月前我還...
    沈念sama閱讀 46,433評論 2 360
  • 正文 我出身青樓晃跺,卻偏偏與公主長得像,于是被迫代替她去往敵國和親毫玖。 傳聞我的和親對象是個殘疾皇子掀虎,可洞房花燭夜當晚...
    茶點故事閱讀 43,587評論 2 350

推薦閱讀更多精彩內(nèi)容