2015-04-07 57 views
0

我爲故事板使用了我的應用程序。以編程方式顯示帶故事板的TabBarConroller

- (IBAction)LogInButtonClicked:(id)sender { 
NSLog(@"clicked"); 


[PFUser logInWithUsernameInBackground:_mailAddressTextField.text password:_passwordTextField.text 
           block:^(PFUser *user, NSError *error) { 
            if (user) { 
             NSLog(@"Login correct"); 
             // show tabBarConroller 
            } else { 
             [self showAlertwithMesage]; 
            } 
           }]; 

}

我怎麼能顯示從故事板我tabBarController如果登錄是正確的? 如果我添加一個segue到Loginbutton,tabBarConroller將會顯示allways。 但我想顯示tabBarConroller如果登錄是正確的

我找到的解決方案直到現在還沒有解決我的問題。

回答

1

您可以將故事板ID分配到故事板中的TabBarController。 登錄成功時出現標籤欄。

UITabBarController *myController = [self.storyboard instantiateViewControllerWithIdentifier:@"yourStoryBoardID"]; 
[self presentViewController:myController animated:YES completion:nil]; 
+0

非常感謝!我forgott分配故事板ID。 – kimbl

相關問題