坚持UISplitViewController在自己的XIB? [英] Stick UISplitViewController in its own XIB?
问题描述
我的iPad应用程序从显示登录名的普通UIView开始。在用户登录之后,屏幕应该切换到分割视图。
XCode的SplitViewTemplate(以及我发现的web上的所有示例)然而,将UISplitViewController放置在主窗口的xib中,并在应用程序委托中定义一个插座。
我发现在我的情况下是不合逻辑的,因为我不需要在启动时的控制器,并希望(按照苹果的指导原则)将分割视图控制器放在自己的XIB。
任何人都有一个工作示例或一个小步骤的指令吗?我总是最终没有加载XIB。
还是不可能?
您可以将一个UISplitViewController转换成一个不同的XIB。您不能将其设为所有者,但您可以将应用程序的委托作为所有者,并在删除登录视图时加载它。
- 将UISplitViewController IBOutlet添加到应用程式委托
- 为iPad建立新的空白XIB
- 将档案拥有者设为应用程式委托类
- 添加UISplitViewController,连接到委托中的插座
- 向分割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.
- Add UISplitViewController IBOutlet to app delegate
- Create a new, empty XIB for iPad
- Set the File's Owner to your app delegate class
- Add a UISplitViewController, connect to outlet in delegate
- 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屋!