简体   繁体   English

UIButton根据标题更改大小

[英]UIButton Change Size Depending on the Title

I am using iOS 6.0 and xCode 4.5 with Autolayouts. 我正在使用带有自动布局的iOS 6.0和xCode 4.5。 I remember I used to resize the UIButton based on its content using [myButton sizeToFit]. 我记得我曾经使用[myButton sizeToFit]根据其内容调整UIButton的大小。 But now it is not working. 但是现在它不起作用了。 The UIButton does have a width constraint. UIButton确实具有宽度约束。

解决方案是检查宽度约束,然后使>> somevalue而不是= somevalue

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM