YIem`s Blog -心比天高命比纸薄-链接找不到的请在站内搜索内容!

iOS-UI-UITabBarControllerDelegate-标签视图控制器

iOS-UI-UITabBarControllerDelegate-标签视图控制器

@interface AppDelegate ()<UITabBarControllerDelegate>

@end

@implementation AppDelegate


// 创建被NC 管理的页面
RootViewController *RootVC = [[[RootViewController alloc] init]autorelease];
UINavigationController *rootNC = [[[UINavigationController alloc] initWithRootViewController:RootVC] autorelease];
// 为每一个界面设置自己的标题风格
rootNC.tabBarItem = [[[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemFeatured tag:10000] autorelease];
ScondViewController *secVC = [[[ScondViewController alloc] init] autorelease];
UINavigationController *secNC = [[[UINavigationController alloc] initWithRootViewController:secVC] autorelease];
    // 为每一个界面设置自己的标题风格
secNC.tabBarItem = [[[UITabBarItem alloc] initWithTitle:@"垃圾桶" image:[UIImage imageNamed:@"100-coffee.png"]  tag:100000] autorelease];
ThirdViewController *thirdVC = [[ThirdViewController alloc] init];
UINavigationController *thirdNC = [[[UINavigationController alloc] initWithRootViewController:thirdVC] autorelease];
    // 为每一个界面设置自己的标题风格
thirdNC.tabBarItem = [[[UITabBarItem alloc] initWithTitle:@"设置" image:[UIImage imageNamed:@"19-gear.png"] selectedImage:[UIImage imageNamed:@"20-gear2.png"]]autorelease];
thirdNC.tabBarItem.badgeValue = @"99+";

// 默认高度49, 5个以上会重叠

UITabBarController *tabBarC = [[UITabBarController alloc] init];
// 重要属性 - 所管理的界面数组
tabBarC.viewControllers = @[rootNC, secNC, thirdNC];
// 提示(99+)
tabBarC.delegate = self;

// 风格属性
// 边框颜色

// tabBarC.tabBar.tintColor = [UIColor greenColor];

tabBarC.tabBar.barTintColor = [UIColor lightGrayColor];
tabBarC.tabBar.backgroundColor = [UIColor blackColor];
// 是否半透明
tabBarC.tabBar.translucent = YES;
// 背景图片
[tabBarC.tabBar setBackgroundImage:[UIImage imageNamed:@"屏幕快照 2016-01-20 下午4.10.46.pngb"]];


self.window.rootViewController = tabBarC;
[tabBarC release];

return YES;

}
//





当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »