[OC] UITabBarController-LMLPHP

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;
}
05-11 18:16