0
我想在我的應用程序設置的TabBar,在我的appDelegate我做這個啓動tabbarcontroller:IOS:在secondviewcontroller
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
UIViewController *viewController1 = [[[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil] autorelease];
UIViewController *viewController2 = [[[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil] autorelease];
[viewController2 viewDidLoad];
UIViewController *viewController3 = [[[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil] autorelease];
[viewController3 viewDidLoad];
UIViewController *viewController4 = [[[FourthViewController alloc] initWithNibName:@"FourthViewController" bundle:nil] autorelease];
[viewController4 viewDidLoad];
self.tabBarController = [[[UITabBarController alloc] init] autorelease];
self.tabBarController.viewControllers = @[viewController1, viewController2, viewController3, viewController4];
self.viewController = [[[HomeViewController alloc] initWithNibName:@"HomeViewController" bundle:nil] autorelease];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
你可以看到,我想不會立即開始我的應用程序標籤欄,其實我開始我的應用程序與HomeViewController
我HomeViewController裏面我打開viewController1有:
FirstViewController *first = [[FirstViewController alloc]initWithNibName:@"FirstViewController" bundle:nil];
[self presentViewController:first animated:YES completion:nil];
[first release];
但在我firstviewcontroller我沒有看到我的TabBar,爲什麼呢? (我聲明,如果我沒有使用homeviewcontroller,應用程序可以正常工作)