码迷,mamicode.com
首页 > 其他好文 > 详细

[OC] UITabBarController

时间:2015-12-30 23:52:57      阅读:212      评论:0      收藏:0      [点我收藏+]

标签:

技术分享

 

1. New CocoaTouch class -> Select Objective C -> named RootViewController

2. Disable APC error.

3. Open AppDelegate.m file and edit as below.

 

#import "AppDelegate.h"
#import "RootViewController.h"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    // Override point for customization after application launch.
    RootViewController *rootVC = [[RootViewController alloc] init];
    UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController: rootVC];
    [rootVC release];
    
    navController.title = @"ShouYe";
    UIViewController *vc1 = [[UIViewController alloc] init];
    vc1.title = @"ShouCang";
    UIViewController *vc2 = [[UIViewController alloc] init];
    vc2.title = @"SouSuo";
    UIViewController *vc3 = [[UIViewController alloc] init];
    vc3.title = @"Wo";
    
    NSArray *controllers = [NSArray arrayWithObjects:navController, vc1, vc2, vc3, nil];
    
    [navController release];
    [vc1 release];
    [vc2 release];
    [vc3 release];
    
    UITabBarController *tabBarController = [[UITabBarController alloc] init];
    tabBarController.viewControllers = controllers;

    self.window.rootViewController = tabBarController;
    [tabBarController release];
    
    
    return YES;
}

 

[OC] UITabBarController

标签:

原文地址:http://www.cnblogs.com/webglcn/p/5090162.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!