2009-09-02 33 views
0

我正在构建一个UITableViewCell。我为我的表格视图单元格使用样式UITableViewCellStyleSubtitle。在单元格的textLabel中,我有可能需要换行的数据。因此,为了适应,我想向下移动detailTextLabel,以便包裹的文本不被detailTextLabel中的文本覆盖。我正在尝试以下操作:iPhone - 在UITableViewCell中移动detailTextLabel

CGPoint tempPoint = tableViewCell.detailTextLabel.center; 
tempPoint.y += 100; 
tableViewCell.detailTextLabel.center = tempPoint; 

我试过类似的方法与标签的框架,但我无法让它移动。当我前后记录中心点的y时,我总是看到它从0开始,然后仅为100。我正在使用NSLog中的%f标志来查看该值。这一切都发生在功能:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 

任何帮助将是伟大的。

回答

2

我分类了UITableViewCell并实现了 - (void)layoutSubviews方法。我用这种方法移动了标签。

+0

我不得不这样做,为了达到这个目的。 –

相关问题