Iphone 调整UILabel的大小';当方向发生变化时,在UITableView上显示

Iphone 调整UILabel的大小';当方向发生变化时,在UITableView上显示,iphone,objective-c,uitableview,resize,uilabel,Iphone,Objective C,Uitableview,Resize,Uilabel,我在自定义UITableViewCell中有3个UILabel。当设备更改其方向时,这些UILabel的宽度必须更改,因为tableView的宽度会更改。我的问题是,当设备旋转时,如何调整标签的大小。最简单的方法是将标签的autoresizingMask设置为适当的值。你可能会想要这样的东西: leftLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleRightMargin

我在自定义UITableViewCell中有3个UILabel。当设备更改其方向时,这些UILabel的宽度必须更改,因为tableView的宽度会更改。我的问题是,当设备旋转时,如何调整标签的大小。

最简单的方法是将标签的
autoresizingMask
设置为适当的值。你可能会想要这样的东西:

leftLabel.autoresizingMask   = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleRightMargin;
centerLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
rightLabel.autoresizingMask  = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin;

最简单的方法是将标签“
autoresizingMask
设置为适当的值。你可能会想要这样的东西:

leftLabel.autoresizingMask   = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleRightMargin;
centerLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
rightLabel.autoresizingMask  = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin;