UI 元素 - 使位置变得流畅?
我意识到您可以通过使用自动调整大小蒙版来提供灵活的宽度/高度,从而使尺寸变得流畅。
制作位置流体怎么样?
例如,如果我将 UIButton 的中心设置为 self.view.frame.size.width/2 ,如果视图大小发生变化,如何使其重新定位?
谢谢 汤姆
I realise you can make dimentions fluid by using the autoresizing mask to give a flexible width/height.
What about making a position fluid?
For instance if I set the centre of a UIButton at self.view.frame.size.width/2
how can I make it reposition if the view changes size?
Thanks
Tom
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将按钮的
autoresizingMask
设置为UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin
。Set the button's
autoresizingMask
toUIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin
.