I've 3 UILabel's inside a custom UITableViewCell. The开发者_如何转开发 width of these UIlabels must change when the device changes it's orietation because the tableView's width changes. My problem was how could I resize the label when the device rotation happens.
The easiest way is to set the labels' autoresizingMask
to appropriate values. You'll probably want something like this:
leftLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleRightMargin;
centerLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
rightLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin;
精彩评论