2013-03-28 37 views
0

我對xcode相當陌生,所以如果我提出不好的問題,我很抱歉。我的問題是我創建了一個選項卡式應用程序,但希望在顯示選項卡之前顯示一個登錄屏幕。有很多關於這個的帖子,共識是你需要讓你的tabBarController呈現一個視圖控制器。這是有道理的,但由於某種原因,我的應用程序不顯示登錄屏幕。我將在下面粘貼我的appDelegate.m代碼。任何幫助將非常感激。xcode與loginViewController的選項卡式應用程序

韓國社交協會

- (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; 
} 
+0

嘗試將'_tabBarController'更改爲'self.tabBarController'並將'presentViewController'調用移動到'makeKeyAndVisible'之後... – jjv360

+0

工作正常! – Richie

回答

1

你應該做的從控制器的演示文稿中第一個選項卡(假設這是你要顯示的登錄屏幕駁回後,控制器)。將view動畫參數設置爲NO的viewDidAppear方法進行演示。

相關問題