在动画期间阻止UITableViewCell布局

Joc*_*hen 7 cocoa-touch objective-c uitableview ios

我有一个UIViewControllerUITableView的内部UINavigationController.
当我隐藏导航栏时

[self.navigationController setNavigationBarHidden:YES animated:YES];
Run Code Online (Sandbox Code Playgroud)

调整表视图的大小,并在底部显示一个新单元格.此单元格布置隐藏导航栏的动画内部的子视图.

细胞动画

有没有办法从动画中排除单元格的布局?

emb*_*emb 7

您可以通过实现UITableViewDelegate方法来阻止单元格动画tableView:willDisplayCell:forRowAtIndexPath::

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    [UIView performWithoutAnimation:^{
        [cell layoutIfNeeded];
    }];
}
Run Code Online (Sandbox Code Playgroud)