【发布时间】:2015-05-11 08:45:29
【问题描述】:
我已使用以下代码设置行插入。我只在插入和删除行时使用UITableViewRowAnimationNone,但有时,正如您在下面的 gif 中看到的那样,行从顶部或底部动画。在大多数情况下,它不会像我想要的那样设置动画,但有时它会在插入和删除时设置动画。我不是在谈论扩展表格视图以显示插入的单元格,我的意思是单元格似乎从底部或顶部滑入。
下面是控制插入动画的方法:
- (void)contentHeaderFooterView:(NFContentHeaderFooterView *)headerFooterView sectionOpened:(NSInteger)section{
NSIndexPath *pathToAdd = [NSIndexPath indexPathForRow:0 inSection:section];
[self.tableView beginUpdates];
[self.tableView insertRowsAtIndexPaths:@[pathToAdd] withRowAnimation:UITableViewRowAnimationNone];
[self.tableView endUpdates];
}
这里是控制删除动画的方法。
- (void)contentHeaderFooterView:(NFContentHeaderFooterView *)headerFooterView sectionClosed:(NSInteger)section{
NSIndexPath *pathToDelete = [NSIndexPath indexPathForRow:0 inSection:section];
[self.tableView beginUpdates];
[self.tableView deleteRowsAtIndexPaths:@[pathToDelete] withRowAnimation:UITableViewRowAnimationNone];
[self.tableView endUpdates];
}
【问题讨论】:
-
同样的问题,似乎是一个错误。
标签: ios uitableview uiview caanimation