Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone TTStyledTextLabel如何在方向更改时更改宽度/高度?_Iphone_Ios_Three20 - Fatal编程技术网

Iphone TTStyledTextLabel如何在方向更改时更改宽度/高度?

Iphone TTStyledTextLabel如何在方向更改时更改宽度/高度?,iphone,ios,three20,Iphone,Ios,Three20,我想我被卡住了。如何使TTStyledTextLabel扩展到可用的宽度/高度 我在UILabel上看到,您可以通过以下方式进行操作: CGSize captionSize = [_label.text sizeWithFont:_label.font constrainedToSize:CGSizeMake(maxWidth, CGFLOAT_MAX) lineBrea

我想我被卡住了。如何使TTStyledTextLabel扩展到可用的宽度/高度

我在UILabel上看到,您可以通过以下方式进行操作:

CGSize captionSize = [_label.text sizeWithFont:_label.font 
                             constrainedToSize:CGSizeMake(maxWidth, CGFLOAT_MAX)
                                 lineBreakMode:UILineBreakModeWordWrap];

_label.frame =  CGRectMake(boundsX + 90 , 40, captionSize.width, captionSize.height);

如何对TTStyledTextLabel执行相同的操作?

尝试设置自动调整大小掩码。要固定相对于superview的左右边界,并使其拉伸宽度以适应两者之间的空间,可以使用:

[label setAutoresizingMask:UIViewAutoresizingMaskFlexibleWidth];
每个
UIView
都支持自动调整掩码大小。SuperView及其视图控制器还可以使用
-[UIView layoutSubviews]
-[UIViewController viewDidLayoutSubviews]
更积极地调整其子视图的大小