我想在我的应用程序中设置一个标签栏,在我的 appDelegate 中我这样做:
- (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 中,我没有看到我的标签栏,为什么?(我声明如果我在没有 homeviewcontroller 的情况下开始,该应用程序可以在 tabbar 上正常工作)