首页 > 其他 > 详细

[OC] UITabBarController

时间:2015-12-30 23:52:37      阅读:206      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!