我将 UILabel 添加到简单的 UITableViewCell 中,但是当我将设备旋转到横向时,UILabel 不会移动到右侧,即使使用 myLabel.autoresizingMask = UIViewAutoResizingFlexibleRightMargin;
它位于 UITableViewCell 的中间。
在纵向模式下,myLabel
位于 UITableViewCell 的右侧。这是代码:
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];
当我将设备旋转到横向模式时,如何将此 UILabel 移动到单元格的右侧?
最佳答案
如果想移到右侧,需要设置UIViewAutoresizingFlexibleLeftMargin
(因为左边距会增大)
关于iphone - UITableViewCell 中的 UILabel autoresizingMask,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7685105/