UI13-UITabBarController底部导航视图

来源:互联网 发布:oppo手机网络智能优化 编辑:程序博客网 时间:2024/06/06 04:26

分别创建PhotoAlbumViewController、ShootViewController、MyViewController三个视图控制器器

在AppDelegate中编写代码:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    

    self.window = [[UIWindowalloc] initWithFrame:[[UIScreenmainScreen]bounds]];

    //创建ShootViewController对象

    ShootViewController *shoot = [[ShootViewControlleralloc] init];

    //创建PhotoAlbumViewController对象

    PhotoAlbumViewController *album = [[PhotoAlbumViewControlleralloc]init];

    

    //创建MyViewController对象

    MyViewController *my = [[MyViewControlleralloc] init];

    

    //创建UITabBarController对象,将前面创建的视图控制器加入该对象

    UITabBarController *tabBarController = [[UITabBarControlleralloc]init];

    tabBarController.viewControllers =@[album,shoot,my];

    self.window.rootViewController = tabBarController;

    self.window.backgroundColor = [UIColorwhiteColor];

    [self.windowmakeKeyAndVisible];

    

    

    returnYES;

}