2009-09-02 35 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

我不得不這樣做,爲了達到這個目的。 –

相關問題