Ret*_*rie 3 objective-c uitableview ipad ios6.1
我有一个非常令人沮丧的问题.我有一个带UITableView的应用程序.当我从表视图中删除一个单元格时,它将从数据模型中删除,然后我调用以下内容:
-(void)removeItem:(NSIndexPath *)indexPath {
[self.tableView beginUpdates];
[self.tableView deleteRowsAtIndexPaths:@[indexPath]
withRowAnimation:UITableViewRowAnimationRight];
[self.tableView endUpdates];
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,我已经像上面那样尝试过了,我尝试过不使用animateWithDuration.我甚至尝试过CATransaction,但是不管怎样,动画都没有发生.
我的模拟器中的动画很慢,当我从列表中删除一个项目时,它会正确删除,但没有动画.它只是消失,并在重新加载表视图数据之前留下空白片刻.
我搜遍了SO和谷歌,我似乎无法找到答案.有任何想法吗?
是否可能与我在调用上述函数之前从数据模型中删除对象这一事实有关?
编辑:删除动画块,因为它不正确
根据这个你根本不需要使用它animateWithDuration:animations:.
试试这样吧
-(void)removeItem:(NSIndexPath *)indexPath {
[self.tableView beginUpdates];
[self.tableView deleteRowsAtIndexPaths:@[indexPath]
withRowAnimation:UITableViewRowAnimationRight];
[self.tableView endUpdates];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8401 次 |
| 最近记录: |