我将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移动到单元的右侧?
发布于 2011-10-07 17:36:54
如果你想把它移到右边,你需要设置UIViewAutoresizingFlexibleLeftMargin (因为左边距会增加)
https://stackoverflow.com/questions/7685105
复制相似问题