从 UIViewController 方法更改 UIWindow 的呈现视图
我有一个简单的应用程序,其中包含 UIViewController 的两个子类。
我想通过调用 UIViewController 子类之一的方法来更改应用程序的 UIWindow 显示的视图。
本质上,我只是在乱搞,我正在尝试构建一个带有登录屏幕的简单测试应用程序,在用户输入凭据后会显示一个主视图。我不太熟悉iOS编程的窗口和视图机制,我目前正在阅读 http://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/WindowsandViews/WindowsandViews.html#//apple_ref/doc/uid/TP40009503-CH2-SW1 并尝试了解一些相关知识。
I have a simple application with two subclasses of UIViewController.
I want to change the view being displayed by my application's UIWindow by calling a method from one of my UIViewController subclasses.
Essentially I'm just messing around and I'm trying to construct a simple test application with a login screen, that after a user enters credentials a main view is presented. I'm not too familiar with the window and view mechanisms of iOS programming, and I'm currently reading http://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/WindowsandViews/WindowsandViews.html#//apple_ref/doc/uid/TP40009503-CH2-SW1 and attempting to learn a bit about it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果这是为了登录屏幕,您应该直接将主视图控制器添加到窗口,并将登录视图控制器添加为主视图控制器内的模式视图。
在 applicationDidFinishLaunching 内部...
在 MainViewController 内部
如果登录成功,
If this is for the purpose of a login screen, you should add the main view controller to window directly, and add the login view controller as a modal view inside the main view controller.
Inside applicationDidFinishLaunching...
Inside MainViewController
if login successful,