【发布时间】:2012-02-26 09:09:30
【问题描述】:
我有这个代码:
cell.textLabel.text = [arrBugs objectAtIndex:indexPath.row];
cell.detailTextLabel.text = @"just a text";
cell.imageView.image = [UIImage imageNamed:[arrImages objectAtIndex:indexPath.row]];
cell.textLabel.textAlignment = UITextAlignmentRight;
cell.detailTextLabel.textAlignment = UITextAlignmentRight;
当cell.detailTextLabel.text 不存在时,textLabel 向右对齐没有任何问题,但是一旦我添加了cell.detailTextLabel.text,它们都会向左对齐。我该如何解决这个问题?我希望它们都向右对齐。
我不使用自定义表格视图单元格。
【问题讨论】:
-
你怎么知道它在单元格中没有文本的情况下工作?
-
当我只写 cell.textLabel.text = @"text"; cell.textLabel.textAlignment = UITextAlignmentRight;有用。但是当我添加 cell.detailTextLabel.text = @"just a text"; cell.detailTextLabel.textAlignment = UITextAlignmentRight;突然,单元格向左对齐而不是向右对齐..
-
UITextAlignment 已弃用。使用 NSTextAlignment。
标签: iphone objective-c ios uitableview