微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ios – 扩展UITableViewCell

我试图扩大一个UITableViewCell以显示更多的内容。到目前为止,我已经有了动画,但我的问题是动画完成之前出现的新内容。这是我的代码:

在配置单元格时,描述标签和读取按钮都开始隐藏。

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    self.selectedRow = indexPath;
    SDJCell *cell = (SDJCell *)[tableView cellForRowAtIndexPath:indexPath];
    [tableView beginUpdates];
    [tableView endUpdates];
    cell.descriptionLabel.hidden = NO;
    cell.readButton.hidden = NO;
}

-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath {
    SDJCell *cell = (SDJCell *)[tableView cellForRowAtIndexPath:indexPath];
    [tableView beginUpdates];
    [tableView endUpdates];
    cell.descriptionLabel.hidden = YES;
    cell.readButton.hidden = YES;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    if(selectedRow && indexPath.row == selectedRow.row) {
    return 100;
    }
    return 44;
}

任何想法,我怎么可以揭示这个额外的内容,在细胞完成扩张后?

谢谢!!

解决方法

我有完全相同的问题。解决方案是设置单元格的自动调整蒙版,以便它与超级视图一起调整大小。

cell.autoresizingMask = UIViewAutoresizingFlexibleHeight;
cell.clipsToBounds = YES;

您也可以在sotoryboard中执行此操作,两个标志都可以在身份检查器下设置

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐