#import "AppDelegate.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
UITabBarController *tabBarController = [[UITabBarController alloc]init];
UIViewController *vc1 = [[UIViewController alloc]init];
vc1.view.backgroundColor =[UIColor redColor];
vc1.tabBarItem.title = @"消息";
vc1.tabBarItem.badgeValue = @"123";
UIViewController *vc2 = [[UIViewController alloc]init];
vc2.tabBarItem.title = @"联系人";
vc2.tabBarItem.badgeValue = @"123";
vc2.view.backgroundColor =[UIColor greenColor];
UIViewController *vc3 = [[UIViewController alloc]init];
vc3.view.backgroundColor =[UIColor grayColor];
vc3.tabBarItem.title = @"动态";
vc3.tabBarItem.badgeValue = @"123";
UIViewController *vc4 = [[UIViewController alloc]init];
vc4.tabBarItem.title = @"设置";
vc4.tabBarItem.badgeValue = @"123";
vc4.view.backgroundColor =[UIColor blueColor];
//两种方式
// tabBarController.viewControllers = @[vc1,vc2,vc3,vc4];
[tabBarController addChildViewController:vc1];
[tabBarController addChildViewController:vc2];
[tabBarController addChildViewController:vc3];
[tabBarController addChildViewController:vc4];
self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor =[UIColor redColor];
self.window.rootViewController = tabBarController;
[self.window makeKeyAndVisible];
return YES;
}
UITabBarViewController
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 前言 Google Play应用市场对于应用的targetSdkVersion有了更为严格的要求。从 2018 年...