AutoSizing 时 UISlider 距底部的距离恒定

发布于 2024-11-15 21:47:07 字数 341 浏览 3 评论 0原文

我想将 UISlider 固定在距屏幕底部恒定的距离。我可以在界面生成器尺寸检查器中轻松完成此操作。我会简单地使用自动调整大小方块边缘的红色 I 形锁。在下图中,它将锁定在左上角。

我想锁定底部并以编程方式执行此操作,而不是使用界面生成器。

我一直在使用以下代码来调整大小,但现在我希望将其锁定到底部: view.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)

请帮忙。

尺寸检查器

I want to fix a UISlider a constant distance away from the bottom of the screen. I can do this easily in the interface builder size inspector. I would simply use the red I shaped locks at the edge of autosizing square. In the image below it would lock to the top left.

I want to lock to the bottom and do it programmatically, not with interface builder.

I've been using the following code to resize but i now want it locked to the bottom :
view.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)

Please help.

Size Inspector

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

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

发布评论

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

评论(1

悲凉≈ 2024-11-22 21:47:07

您需要有灵活的上边距。您还可以添加UIViewAutoresizingFlexibleWidth来查看它如何水平调整大小。

view.autoresizingMask = UIViewAutoresizingFlexibleTopMargin;

You need to have flexible top margin. You can also add UIViewAutoresizingFlexibleWidth to see how it resizes horizontally.

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