让 Interface Builder 在 SplitViewControllers DetailView 中布局我的内容

发布于 2024-10-19 17:23:18 字数 490 浏览 3 评论 0原文

我正在嘲笑 Interface Builder 和 SplitViewController 的 DetailView。 我在detailView中有一个尺寸为700px x 700px的UIImageVIew,没有别的,我希望它始终将自己定位在中心。因为它的尺寸为 700x700,所以它应该适合纵向和横向。然而,还有一个 UIToolBar 管理顶部 44 个像素。如果我使用 IB 并将 UIImageViews contentMode 设置为 center,将DetailViews contentMode 设置为 center,则 UIImageView 的位置会覆盖工具栏的几个像素。 (但仍然在中心)

我尝试将 UIImageView 锚定到底部,但它仍然将自己定位在中心,并且布局仍然覆盖工具栏。

我将如何将布局设置为“UIImageView:扣除工具栏占用的空间并将您自己放置在剩余视图的中心”?

希望有人可以提供帮助,IB 布局引擎有点繁重,需要通过反复试验来弄清楚:)

提前谢谢您。

I was mocking about with Interface Builder and the DetailView of a SplitViewController.
I have a UIImageVIew of size 700px by 700px in the detailView and nothing else, I would like it to always position itself in the center. Because it is 700x700 it should fit in both portrait and landscape. However, there is also a UIToolBar governing the top 44 pixels. If I use IB and set the UIImageViews contentMode to center and the detailViews contentMode to center, the UIImageView is positioned so that it covers a few pixels of the toolbar. (but in the center non the less)

I have tried anchoring the UIImageView to the bottom, but it still positions itself in the center and the layout still covers the toolbar.

How would I go about doing the layout as "UIImageView:Deduct the space the toolbar takes up and position your self in the center of the remaining view" ?

Hope someone can help, the IB layout engine is a bit heavy to figure out by trial and error:)

Thank you in advance.

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

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

发布评论

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

评论(1

烧了回忆取暖 2024-10-26 17:23:18

添加一个从工具栏底部到整个视图底部并从左到右完全拉伸的 UIView。设置其 Struts 和 Springs (cmd-3),以便其垂直和水平调整大小并连接到所有 4 个侧面。然后将您的 UIImageView 放入该视图中,并使用您已经完成的所有相同居中操作。这将改变 UIImageView 的参考框架,因此当它试图位于中心时,它将位于不包括工具栏的视图的中心。让我知道这是否有意义。

Add a UIView that goes from the bottom of the toolbar to the bottom of the entire view and stretches completely left to right. Set its Struts and Springs (cmd-3) so that it resizes vertically and horizontally and is attached to all 4 sides. Then put your UIImageView inside THAT view with all of the same centering you've already done. That will change the UIImageView's frame of reference so when it is trying to be in the center, it'll be in the center of that view which doesn't include the toolbar. Let me know if this makes sense.

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