如何正确切换UIView
我想在我的应用程序中拥有多个可以切换的视图。
在也支持 UISplitViewController 的 UIView 之间切换的正确方法是什么? 是否有支持切换的方式,或者Apple的控制器类是否设计为root和仅root?
我尝试过使用一个根视图和根控制器并交换子视图。子视图之一是 UISplitViewController。它不喜欢这种安排并且无法正确显示。未显示详细视图,主视图显示错误的方向和尺寸。
然后,我尝试管理在应用程序委托的 UIWindow 中添加和删除一个子视图。这在大多数情况下都有效。但是,在 applicationDidFinishLaunching 方法之后添加的视图未正确显示设置。它们大多看起来是正确的,但有时方向认为是肖像,而实际上是风景。另外,当我尝试显示弹出窗口时,它显示在错误的位置。如果我改变方向,它会正确重画。我也有一些随机实例,其中 UISplitViewController 视图未完全显示,就好像其框架大小不正确一样。
衷心感谢任何建议。
I want to have multiple views in my application that I switch between.
What is the proper way to switch between UIViews that also supports UISplitViewController?
Is there a support way to switch or are Apple's controller classes designed to be root and root only?
I've tried having one root view and root controller and swap subviews in and out. One of the subviews is a UISplitViewController. It did not like the arrangement and does not display correctly. The detail view was not displayed, the master view displayed wrong orientation and wrong size.
I've then tried managing adding and removing one subview from the UIWindow in the app delegate. This works most of the time. However, the views added after the applicationDidFinishLaunching method do not appear setup correctly. They mostly look correct, however sometimes the orientation thinks its portrait when in reality its landscape. Also, when I try to display a popover, it shows up in an incorrect location. If I change the orientation, it redraws correctly. I've also have some random instances where the UISplitViewController view does not fully display, as if its frame is incorrectly sized.
Any suggestions heartily appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在
applicationDidFinishLaunching
中,您的对象尚未完成从 NIB 的加载。尝试改用viewDidLoad
方法。用于在视图之间切换的用户界面是什么?如果这些视图之一表示用户进入然后退出的瞬态模式,请考虑使用模态视图。 (请参阅presentModalViewController:animated:。)
我需要更多有关您正在做什么的详细信息才能更具体地回答。
In
applicationDidFinishLaunching
, your objects haven't completed loaded from NIBs yet. Try using aviewDidLoad
method instead.What is the user-interface for switching between views? If one of these views represents a transient mode that the user enters and then exits, consider using a modal view. (See
presentModalViewController:animated:
.)I would need more details about what you're doing to answer more particularly.