效果
-----------------AppDelegate.m-----------------------------------------
#import "AppDelegate.h"
#import "TmallViewController.h"
#import "TaobaoViewController.h"
@interface AppDelegate ()
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
//taobao 页面
TaobaoViewController * taobao = [[TaobaoViewController alloc] init];
UINavigationController * taoNav = [[UINavigationController alloc]initWithRootViewController:taobao];
//设置标题
taoNav.tabBarItem.title = @"Taobao";
//未选中时图片
taoNav.tabBarItem.image = [[UIImage imageNamed:@"taobao-1"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
// 选中图片
taoNav.tabBarItem.selectedImage = [[UIImage imageNamed:@"taobao"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
//Tmall 页面
TmallViewController * tmall = [[TmallViewController alloc] init];
UINavigationController * tmallNav= [[UINavigationController alloc] initWithRootViewController:tmall];
tmallNav.tabBarItem.title = @"天猫";
tmallNav.tabBarItem.image = [[UIImage imageNamed:@"tmall-1"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tmallNav.tabBarItem.selectedImage = [[UIImage imageNamed:@"tmall"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
// 统一设置导航栏的样式
[[UINavigationBar appearance] setTranslucent:NO];
[[UINavigationBar appearance] setTintColor:[UIColor yellowColor]];
UITabBarController *tabberC = [[UITabBarController alloc] init];
//把页面放到TabBarController中
tabberC.viewControllers = [NSArray arrayWithObjects:taoNav,tmallNav, nil];
//TabBarController作为Window的根视图
self.window.rootViewController = tabberC;
return YES;
}