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