gpt4 book ai didi

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

转载 作者:技术小花猫 更新时间:2023-10-29 11:09:17 27 4
gpt4 key购买 nike

我在使用这个 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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com