坚持UISplitViewController在自己的XIB? [英] Stick UISplitViewController in its own XIB?

查看:147
本文介绍了坚持UISplitViewController在自己的XIB?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的iPad应用程序从显示登录名的普通UIView开始。在用户登录之后,屏幕应该切换到分割视图。
XCode的SplitViewTemplate(以及我发现的web上的所有示例)然而,将UISplitViewController放置在主窗口的xib中,并在应用程序委托中定义一个插座。
我发现在我的情况下是不合逻辑的,因为我不需要在启动时的控制器,并希望(按照苹果的指导原则)将分割视图控制器放在自己的XIB。
任何人都有一个工作示例或一个小步骤的指令吗?我总是最终没有加载XIB。



还是不可能?

解决方案

您可以将一个UISplitViewController转换成一个不同的XIB。您不能将其设为所有者,但您可以将应用程序的委托作为所有者,并在删除登录视图时加载它。


  1. 将UISplitViewController IBOutlet添加到应用程式委托

  2. 为iPad建立新的空白XIB

  3. 将档案拥有者设为应用程式委托类

  4. 添加UISplitViewController,连接到委托中的插座

  5. 向分割vew控制器添加视图

然后,您只需在应用程序委托中处理您的登录,加载新的XIB并显示它。


my iPad app starts with a normal UIView showing a login. After the user logged in the screen is supposed to switch to a split view. XCode's SplitViewTemplate (and all examples on the web I found) however, place UISplitViewController in the main window's xib and define an outlet in the app delegate. I find that unlogical in my case because I don't need the controller at startup and would like to (following Apple's guidelines) place the split view controller in its own XIB. Has anybody a working example or a small step by step instruction? I always end up with the XIB not being loaded.

Or is it just NOT possible? But why would it not?

René

解决方案

You can put a UISplitViewController into a different XIB. You cannot have it be the owner, but you can have your app's delegate be the owner and load it when it removes the login view.

  1. Add UISplitViewController IBOutlet to app delegate
  2. Create a new, empty XIB for iPad
  3. Set the File's Owner to your app delegate class
  4. Add a UISplitViewController, connect to outlet in delegate
  5. Add views to split vew controller

Then, you just have to handle your login in the app delegate, load the new XIB, and display it.

这篇关于坚持UISplitViewController在自己的XIB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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