Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TableView动态估算高度UITableViewAutomaticDimension导致动画结束之后cell高度不对数据展示不全 #181

Open
Snail-hash opened this issue Oct 22, 2021 · 2 comments

Comments

@Snail-hash
Copy link

Snail-hash commented Oct 22, 2021

  • (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return UITableViewAutomaticDimension;
    }
  • (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 66;
    }

cell高度根据QMUITextView内容撑开
QMUITextView实现代理
// 实现这个 delegate 方法就可以实现自增高

  • (void)textView:(QMUITextView *)textView newHeightAfterTextChanged:(CGFloat)height {
    BOOL needsChangeHeight = CGRectGetHeight(textView.frame) != height;
    if (needsChangeHeight) {
    UITableView *tableView = [self tableView];
    [tableView beginUpdates];
    [tableView endUpdates];
    }
    }

cell布局 都是给的上下左右边距约束
image

不加载骨架屏是正常显示
image

加载骨架屏动画结束后cell高度撑不开
image

@tigerAndBull
Copy link
Owner

结束动画后,用update系列方法强行刷新试试。

@Snail-hash
Copy link
Author

[self.tableView tab_endAnimationEaseOut];
[self.tableView beginUpdates];
[self.tableView endUpdates];

还是不行

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants