//
// 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];
//设置为不透明
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
网友评论