登录到主应用 [英] Login to main app

查看:108
本文介绍了登录到主应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经构建了主应用程序和登录名.

I've already built the main app and the login.

appDelegate.m didFinishLaunchingWithOptions 中,我有

[self.window addSubview:rootController.view];

哪个会加载mainView.

Which loads up the mainView.

但是,我希望它像成功登录一样首先加载我的登录名,它将加载rootController(主应用程序)等.

However, I would want it to load up my login first as on a successful login, it will load the rootController (main app) etc.

当我放上

[self.validateViewController presentModalViewController:validateViewController animated:YES]; 

并运行该应用程序,我得到的只是一个白屏.

and run the app, all I get is a white screen.

我在做什么错了?

->我尝试执行此操作的原因是因为此刻,我首先加载了rootController,但是在viewDidLoad中,它加载了Login模态.因此,它首先运行numberOfRowsInSection,因此当我最终在登录后进入应用程序时,由于它已经通过numberOfRowsInSection,因此它不会显示任何表视图.

-> The reason I'm trying to do this is because at the moment, I have the rootController load up first but in the viewDidLoad, it loads the Login modal. Because of that, it runs numberOfRowsInSection first and so when I do eventually go into the app after login, it won't show any tableview since it's already gone through numberOfRowsInSection.

推荐答案

您需要在已经显示视图的控制器上运行presentModalViewController.现在,您正在实际要显示的视图上运行presentModalViewController.

You need to run presentModalViewController on a controller that has a view being displayed already. Right now you are running presentModalViewController on the view you actually want to present.

您可以在将rootController添加到应用程序窗口后显示validateViewController:

You could present the validateViewController after adding the rootController to the app window:

[rootViewController presentModalViewController:validateViewController animated:YES];

这篇关于登录到主应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆