[英]What is correct way to make a UIButton change a MutableProperty?
[英]What is the correct way to auto expand a UIButton to the width of an interface on orientation change
我试图在方向改变时自动将UIButton的宽度扩展到界面的宽度。
有人为此有工作代码吗? 我尝试使用自动调整大小蒙版,但是也许我没有使用正确的蒙版。
有多种方法可以做到这一点。 在您的视图控制器子类中,重写-willAnimateRotationToInterfaceOrientation:duration:
或-willRotateToInterfaceOrientation:duration:
您也可以覆盖-viewWillLayoutSubviews
,然后通过查询self.interfaceOrientation
来根据方向调整框架。
然后通过调整约束或更改按钮的框架来更改该按钮的大小。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.