【发布时间】:2009-09-02 14:44:35
【问题描述】:
我正在构建一个 UITableViewCell。我正在为我的表格视图单元格使用样式 UITableViewCellStyleSubtitle。在单元格的 textLabel 中,我有可能需要换行的数据。因此,为了适应,我想将detailTextLabel 向下移动,以便包装的文本不会被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
任何帮助都会很棒。
【问题讨论】:
标签: iphone cocoa-touch uikit uitableview uilabel