//
// AppDelegate.m
// tabBarChang
//
// Created by CJW on 16/12/29.
// Copyright © 2016年 cjw. All rights reserved.
//
#import "AppDelegate.h"
#import "OneViewController.h"
#import "TwoViewController.h"
#import "ThreeViewController.h"
#import "FourViewController.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
//创建window
self.window=[[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor=[UIColor whiteColor];
[self.window makeKeyAndVisible];
//创建tabBarController;它是一个容器,承装viewController
UITabBarController * tabBarC=[[UITabBarController alloc]init];
self.window.rootViewController=tabBarC;
//创建tabBarController的viewControllrs
OneViewController * oneVC=[[OneViewController alloc]init];
//设置按钮的图片和标题
oneVC.tabBarItem=[[UITabBarItem alloc]initWithTitle:@"首页" image:[UIImage imageNamed:@"tab_0"] selectedImage:[UIImage imageNamed:@"tab_c0"]];
TwoViewController * twoVC=[[TwoViewController alloc]init];
twoVC.tabBarItem=[[UITabBarItem alloc]initWithTitle:@"收藏" image:[UIImage imageNamed:@"tab_1"] selectedImage:[UIImage imageNamed:@"tab_c1"]];
ThreeViewController * threeVC=[[ThreeViewController alloc]init];
threeVC.tabBarItem=[[UITabBarItem alloc]initWithTitle:@"位置" image:[UIImage imageNamed:@"tab_2"] selectedImage:[UIImage imageNamed:@"tab_c2"]];
FourViewController * fourVC=[[FourViewController alloc]init];
fourVC.tabBarItem=[[UITabBarItem alloc]initWithTitle:@"设置" image:[UIImage imageNamed:@"tab_3"] selectedImage:[UIImage imageNamed:@"tab_c3"]];
tabBarC.viewControllers=@[oneVC,twoVC,threeVC,fourVC];
tabBarC.selectedIndex=0;
[UITabBar appearance].tintColor = [UIColor orangeColor];
return YES;
}
@end