插入没有任何动画的UITableView行 [英] Insert UITableView row without ANY animation

查看:47
本文介绍了插入没有任何动画的UITableView行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

[self.tableView insertRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:row inSection:0]] 
                      withRowAnimation:UITableViewRowAnimationNone];

在我要插入的每一行之后执行此操作时,幻灯片会向下滑动.我希望他们立即跳到他们的新地方.我不想呼叫reloadData,因为那样我的所有单元格都将被重画.

When doing this every row after the one I'm inserting slides down. I want them to immediately jump to their new place. I don't want to call reloadData since then all my cells would be redrawn.

是否可以删除此动画?

推荐答案

这对我有用:

[UIView setAnimationsEnabled:NO];
[self.tableView beginUpdates];

[self.tableView insertRowsAtIndexPaths:indexPath
                      withRowAnimation:UITableViewRowAnimationNone];

[self.tableView endUpdates];
[UIView setAnimationsEnabled:YES];

希望这会有所帮助.

这篇关于插入没有任何动画的UITableView行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆