AutoSizing 时 UISlider 距底部的距离恒定
我想将 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要有灵活的上边距。您还可以添加
UIViewAutoresizingFlexibleWidth
来查看它如何水平调整大小。You need to have flexible top margin. You can also add
UIViewAutoresizingFlexibleWidth
to see how it resizes horizontally.