我对 xcode 还很陌生,如果我问了不好的问题,我深表歉意。我的问题是我创建了一个选项卡式应用程序,但希望在选项卡显示之前显示一个登录屏幕。有很多关于这个的帖子,共识是你需要让你的 tabBarController 来呈现一个视图控制器。这是有道理的,但由于某种原因,我的应用程序没有显示登录屏幕。我将在下面粘贴我的 appDelegate.m 代码。任何帮助将非常感激。
Tks
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
sleep(3);
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
LoginViewController *loginViewController = [[[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil] autorelease];
UIViewController *viewController1 = [[[SecondViewController alloc] initWithNibName:@"FirstViewController" bundle:nil] autorelease];
UIViewController *viewController2 = [[[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil] autorelease];
self.tabBarController = [[[UITabBarController alloc] init] autorelease];
self.tabBarController.viewControllers = @[viewController1, viewController2];
self.window.rootViewController = self.tabBarController;
[loginViewController setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
[_tabBarController presentViewController:loginViewController animated:YES completion:nil];
[self.window makeKeyAndVisible];
return YES;
}