gpt4 book ai didi

iphone - 重新加载上面的部分时 UITableView 部分标题中出现奇怪的故障

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:42:17 25 4
gpt4 key购买 nike

看看this video .

运行此代码时出现此故障:

[NSFetchedResultsController deleteCacheWithName:@"Root"];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"following == YES"];
[self.fetchedResultsController.fetchRequ­est setPredicate:predicate];
[self.fetchedResultsController performFetch:nil];
[self.tableView beginUpdates];
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:THE_SECTION_WITH_THE_B­LOGS] withRowAnimation:UITableViewRowAnimation­Automatic];
[self.tableView endUpdates];

为什么我重新加载的部分下方的部分标题会像这样更改它的框架?有什么解决办法吗?

编辑:

这是我的viewForHeaderInSection:

(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
if (tableView != self.tableView)
return nil;
BLMenuTableSectionHeaderView *view = nil;

if (section != BLMenuSectionUser) {
view = [[BLMenuTableSectionHeaderView alloc] initWithFrame:CGRectZero];
if (section == BLMenuSectionFollowing){
if ([self blogCount] > 0){
[view setTitle:NSLocalizedString(@"Following", nil)];
[view addSubview:self.editButton];
}else{
self.tableView.editing = NO;
}
}
if (section == BLMenuSectionPosts){
[view setTitle:NSLocalizedString(@"Browse", nil)];
}
else if (section == BLMenuSectionSettings)
[view setTitle:NSLocalizedString(@"Settings", nil)];
}

return view;
}

最佳答案

Afaik,你不应该将 -beginUpdates-endUpdatesreload 结合使用,而是 when inserting or deleting .

不确定这是否会导致您的问题,但可能值得一试。

不管动画类型是不是都一样?

来自 Apple's docs :

Call this method if you want subsequent insertions, deletion, and selection operations (for example, cellForRowAtIndexPath: and indexPathsForVisibleRows) to be animated simultaneously. This group of methods must conclude with an invocation of endUpdates. These method pairs can be nested. If you do not make the insertion, deletion, and selection calls inside this block, table attributes such as row count might become invalid. You should not call reloadData within the group; if you call this method within the group, you will need to perform any animations yourself.

关于iphone - 重新加载上面的部分时 UITableView 部分标题中出现奇怪的故障,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16717941/

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