Reputation: 4929
I add UILabel to simple UITableViewCell, but when i rotate device to landscape, UILabel doesn't move to right side,even with myLabel.autoresizingMask = UIViewAutoResizingFlexibleRightMargin;
it's in the middle of the UITableViewCell.
In portrait mode myLabel
is on the right side of the UITableViewCell. Here is code:
myLabel = [[UILabel alloc] initWithFrame:CGRectMake(252, 12, 60, 20)];
myLabel.font = [UIFont fontWithName:@"Helvetica" size:11];
myLabel.textColor = tableViewCell.detailTextLabel.textColor;
myLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin;
myLabel.highlightedTextColor = [UIColor whiteColor];
myLabel.text = video.duration;
myLabel.tag = 999;
[cell.contentView addSubview:durationLabel];
[myLabel release];
How to move this UILabel to right side of the cell when i rotate my device to landscape mode?
Upvotes: 2
Views: 2646
Reputation: 100811
If you want to move it to the right side, you need to set UIViewAutoresizingFlexibleLeftMargin
(because the left margin will increase)
Upvotes: 5