2011-12-29 7 views

答えて

3

は、あなたが使用したいUIViewController秒のNSArrayを作成します。 UITabBarControllerをインスタンス化し、viewControllersプロパティをこの配列に設定します。次に、tabBarControllerviewをウィンドウに追加します。これはすべてAppDelegate.mファイルで行う必要があります。例:

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

    UIViewController *vc1 = [[UIViewController alloc] init]; 
    UIViewController *vc2 = [[UIViewController alloc] init]; 
    CustomViewController *vc3 = [[CustomViewController alloc] init]; 

    NSArray *viewControllers = [NSArray arrayWithObjects:vc1, vc2, vc3, nil]; 
    [vc1 release]; [vc2 release]; [vc3 release]; 

    UITabBarController *tabBarController = [[UITabBarController alloc] init]; 
    [tabBarController setViewControllers:viewControllers]; 

    [window addSubview:[tabBarController view]]; 
    [window makeKeyAndVisible]; 

    return YES; 
} 
関連する問題