开发者

resizing UILabel's with on UITableView when change in orientation occurs

开发者 https://www.devze.com 2023-01-04 08:40 出处:网络
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

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;
0

精彩评论

暂无评论...
验证码 换一张
取 消