0
首先,我正在使用故事板進行導航。我已經到了一個地步,我正在一個菜單屏幕上顯示4個不同的視圖(僅使用導航控制器),我希望它檢查用戶是否已登錄,如果不是,我希望LoginViewController /視圖提出。我對客觀的c/xcode非常陌生,並且在尋找解決方案後,這就是我所想到的。我不知道如何將它與我的程序聯繫起來。這只是需要鏈接到我的按鈕,或者我完全與我現在在做什麼?檢查用戶登錄故事板前的場景登錄
if (self.appDelegate.userHasActiveLogin) {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"ViewController2"];
[vc setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentModalViewController:vc animated:YES];}
else {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"LoginController"];
[vc setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentModalViewController:vc animated:YES];
}
只是一個提示,如果你還沒有發現這一點,斯坦福在iTunes上的ios開發課程u:https://itunes.apple.com/us/course/coding-together-developing/id593208016 它真的速度瞭解ios開發的過程,講座非常優秀 – Andreas
更新您在〜2小時前提出的原始問題,而不是創建一個新的問題。 http://stackoverflow.com/questions/15708904/verifying-login-before-loading-view-controller – rog