我有一个 UIViewController
,在 UINavigationController
中有一个 UITableView
。
当我用
[self.navigationController setNavigationBarHidden:YES animated:YES];
表格 View 被调整大小,一个新的单元格显示在底部。 此单元格将其 subview 布局在隐藏导航栏的动画中。
有没有办法从动画中排除单元格的布局?
最佳答案
您可以通过实现 UITableViewDelegate 方法 tableView:willDisplayCell:forRowAtIndexPath:
来阻止单元格动画:
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
[UIView performWithoutAnimation:^{
[cell layoutIfNeeded];
}];
}
关于ios - 在动画期间防止 UITableViewCell 布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31435958/