iOS-Masterviewcontroller 不显示

发布于 2025-01-02 04:38:06 字数 266 浏览 3 评论 0原文

我一直在努力解决一个非常奇怪的问题。在我的 iPad 故事板中,我拖动了一个 UISplitViewController。对于详细视图控制器,我放置了一个 UIImage 并将其图像设置为图像。我对主视图控制器做了同样的事情。我这样做只是为了查看主视图控制器和详细视图控制器以横向模式显示。但是,当我在 iPad 模拟器中启动该应用程序时,只有详细视图控制器捕获整个屏幕区域,而主控不显示。我尝试将分割视图控制器的方向设置为横向,以便使其以横向模式启动,但这没有帮助。我知道我在这里遗漏了一些东西。那是什么?先感谢您。

I've been struggling with a very strange problem. In my iPad storyboard I drag a UISplitViewController. To the detail view controller I put a UIImage and set its image to an image. And I do the same thing to the master view controller. I do this just to see both master and detail view controllers display in landscape mode. But when I launch the app in iPad simulator, only the detail view controller captures the whole screen area and master does not show up. I tried setting the orientation of the split view controller to Landscape so that make it start in landscape mode but that did not help. I know I'm missing something here. What is that? Thank you in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤蝉 2025-01-09 04:38:07

发现问题了。看来我必须设置主视图控制器和详细视图控制器来支持某些方向。这意味着仅将视图控制器拖动到故事板,使其成为细节/主视图控制器并将图像放入其中是行不通的。我们必须创建 UIViewController 的子类,并将故事板中的类设置为这些新创建的 UIViewController 自定义子类。这是因为我们需要在两个视图控制器中实现 shouldAutoRotate... 方法。

Found the problem. It seems I have to set both master and detail view controllers to support certain orientations. It means just dragging a view controller to the the storyboard, making it the detail/master view controller and putting an image inside won't work. We have to create a subclass of UIViewController and set the classes in the storyboard to these newly created UIViewController custom subclasses. It's because we need to implement shouldAutoRotate... method in both view controllers.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文