【问题标题】:IPhone - Move detailTextLabel within UITableViewCelliPhone - 在 UITableViewCell 中移动 detailTextLabel
【发布时间】: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


    【解决方案1】:

    我继承了 UITableViewCell 并实现了 - (void)layoutSubviews 方法。我在那个方法中移动了标签。

    【讨论】:

    • 我必须这样做才能实现这一目标。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-01-16
    • 1970-01-01
    • 1970-01-01
    • 2015-05-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多