Mic*_*ael 5 uitableview uiview caanimation ios
我已使用以下代码设置行插入.我只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];
}
Run Code Online (Sandbox Code Playgroud)
这是控制删除动画的方法.
- (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];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
919 次 |
| 最近记录: |