如何用 UISplitView 控制器替换 UIViewController?
我的是一个普通的视图控制器应用程序。当我单击此 mainView 上的按钮时,它会添加第二个视图(不同的 xib)作为 mainView 的子视图。我希望将第二个视图替换为分割视图。所以这意味着我应该用 UISplitViewController 替换第二个视图控制器,不是吗?
我可以这样做吗?是否可以像 v 添加 viewcontroller 的视图一样添加 splitviewcontroller 的视图?
Mine is a normal viewcontroller application. When I click a button on this mainView, it adds a 2nd view(a different xib) as a subview to the mainView. I want this 2nd view to be replaced by a splitview. So it means I should replace the 2nd view controller with a UISplitViewController, isnt it?
Can I do that? Is it possible to add a splitviewcontroller's view like v add a viewcontroller's view?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该知道,目前,
UISplitViewController
的唯一官方用途是作为应用程序的根视图控制器;苹果并不打算让它成为一个子视图控制器。显然,这是由于处理 iPad 旋转的错误造成的,可能会在以后修复。因此,您应该避免将UISplitViewController
的视图添加为任何内容的子视图。You should be aware that, currently, the only official usage of
UISplitViewController
is as a root view controller of an application; Apple does not intend for it to be a child view controller. Apparently, this is due to bugs with handling rotation of the iPad, and may get fixed at a later date. So you should avoid adding aUISplitViewController
's view as a subview to anything.您可以对 UIViewController 进行子类化,然后在 init 中:
然后将其用作普通的 UIViewController。
You can subclass UIViewController and then in the init:
Then just use this as a normal UIViewController.