iphone - UITableView 中的错误(deleteSections :withRowAnimation: )?

标签 iphone ios uitableview animation

我在使用这个 UITableView method 时遇到问题:

- (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation

首先文档说:

animation: YES to animate the deletion of sections, otherwise NO.

但是参数动画其实是枚举UITableViewRowAnimation类型,不是BOOL!?

那么如何禁用动画呢?我试过 NOUITableViewRowAnimationNone。什么都不管用。部分删除始终是动画的。

我知道我可以改用[tableView reloadData]。那会解决我的问题。我只是好奇这是否是一个已知问题,以及是否可以使用此 tableview 方法禁用动画。

谢谢!

最佳答案

这有点像 hack,但这摆脱了插入动画:

[UIView setAnimationsEnabled:NO];
[self.tableView insertRowsAtIndexPaths:insertedIndexPaths withRowAnimation:UITableViewRowAnimationNone];
[UIView setAnimationsEnabled:YES];

关于iphone - UITableView 中的错误(deleteSections :withRowAnimation: )?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6431806/

相关文章:

ios - 声音仅在 iOS 中首次使用 AVAudioEngine 播放

UITableViewCell 中的 iOS 容器 View

iphone - 使用 JSON 问题在 UITableView 中导航缓慢

ios - 使用协议(protocol)在 swift 中编写自定义函数

ios - 当请求超过限制时如何解析响应?

iphone - 如何使用 iPhone SDK 通过蓝牙交换数据?

iphone - 查找最近的CLLocation

iphone - 触发 UIApplicationDidBecomeActiveNotification 后会调用什么?

iphone - iOS5 中的 viewController 对象 BAD_ACCESS?

ios - 在 UIPageViewControl 中的 View Controller 之间创建分隔符