我有一个应用程序,它有一个登录导航控制器和一个标签栏控制器。我已经将我的标签栏控制器设置为根控制器,但是我希望登录导航控制器显示为模式,以便在登录时可以将其解除,而如果是的话,则可以不显示它。它正在阅读正确的内容,但未能提供landingviewcontroller
。当我运行应用程序时,它直接跳转到TabBarController。作为模态iOS呈现登录?
我的代码如下:
我有检查,如果你是在我的应用程序委托这是我要告诉它呈现着陆视图控制器(登录)登录的方法。我从步进通过其正确判断,我不是在登录和去这行代码上运行的知道:
[self.window.rootViewController presentViewController:landingVC animated:YES completion:nil];
完整的应用程序的委托:
#import "GFAppDelegate.h"
#import "GFCredentialStore.h"
@implementation GFAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:[NSBundle mainBundle]];
UIViewController *tabBarController = [storyboard instantiateInitialViewController];
UIViewController *landingVC = [storyboard instantiateViewControllerWithIdentifier:@"LandingViewController"];
GFCredentialStore *store = [[GFCredentialStore alloc] init];
if (store.isLoggedIn) {
self.window.rootViewController = tabBarController;
} else {
[self.window.rootViewController presentViewController:landingVC animated:YES completion:nil];
}
// Set root view controller and make windows visible
[self.window makeKeyAndVisible];
return YES;
}
我试着要清楚这一点,但要理解这可能是因为写得不好而令人困惑。谢谢你的帮助。
非常感谢。完美的作品。任何想法我可以在loginViewController中解雇这个,我必须导入“AppDelegate”或创建一个ViewController的新实例,以在单独的控制器中访问它。 – jckly
[self dismissViewControllerAnimated:YES completion:nil]; - 在loginViewController – xexe
再次感谢!整理出来。 – jckly