如何在与其他视图相撞的地方修剪UIImageView

发布于 2025-01-30 17:30:56 字数 310 浏览 3 评论 0原文

我有一条界线,可以浏览一些视图,并且应该在它们之间发生碰撞的地方有空间。我该怎么做?行是UIImageView,整个屏幕是Uiview类。

当然,我可以制作4个图像视图并相应地放置它们,但是我觉得有一种使其更漂亮的方法。

有关屏幕截图的更多信息,谢谢。

I have a line that goes through some views and should have spaces in places that collide between them. How can I do that? Line is a UIIMageView and the whole screen is a UIView class.

Of course, I can make 4 image views and place them accordingly, but I feel like there is a way to make it prettier.

More info on screenshot how it should be, thank you.

enter image description here

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

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

发布评论

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

评论(1

雪若未夕 2025-02-06 17:30:56

这是我长期使用的解决方案,没有图像:
stackView:horizo​​ntal:hixhtal and plosectal

我使用InterfaceBuilder仅逐步描述,因此我只会扩展所有subviews,并通过在IB(InterfaceBuilder)上更改其名称来注意视图的大小,然后进行。屏幕截图将其连接起来。

stackView是出色的查看容器,它减少了您的时间进行布局以进行限制甚至没有约束的情况。它允许您轻松地交换子视图的位置,而无需更改布局设置或需要再次执行布局。

希望您可以解决问题。

Here is my solution for long-time usage, without image:
StackView: horizontal and fill with subView self-constrained.

I use InterfaceBuilder only it is hard to describe step by step so I just expand all subViews and note the size of views by changing its name on IB (InterfaceBuilder), then make a screenshot to attach it here.

StackView is one of great View Container that reduces your time to do layouts for views with constraints or even without constraints. It allows you can swap position of subviews easily without changing the layout setting or need to perform layouts again.

Hope that you can solve your problem.

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