我想找出textLabel
的{{1}}属性的默认x位置。最简单的方法是什么?
干杯,
彼得
答案 0 :(得分:2)
cell.textLabel.frame.origin.x
为您提供textLabel相对于其包含视图的位置。
答案 1 :(得分:1)
您可以通过获取其frame.origin.x
属性来获取UILabel的x位置。因此,对于单元格的标签,您将使用cell.textLabel.frame.origin.x
。
请注意,您对textLabel
中的默认detailLabel
和UITableViewCell
所做的工作并不多。您最好的选择通常是create custom cell并使用它。