ios - [self.tableview reloadData];导致闪烁

标签 ios tableview reloaddata

问题是 UI 出现然后更新:产生闪烁效果。

我希望 UI 仅在用户进入应用程序时更新一次,因此我在 ViewDidLoad 中重新加载了 ..这是代码..任何帮助如何消除这种闪烁......一些代码示例会有所帮助。

- (void)viewDidLoad { 

[super viewDidLoad];

self.myTableView.dataSource = self;
self.myTableView.delegate = self;

PFQuery * getCollectionInfo = [PFQuery queryWithClassName:@"Collection"];   // make query

[getCollectionInfo orderByDescending:@"updatedAt"];
[getCollectionInfo setCachePolicy:kPFCachePolicyCacheThenNetwork];

dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_async(queue, ^{
    [getCollectionInfo findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
        if (!error) {
            CollectionQueryResult = (NSMutableArray *)objects;
                [self.tableView reloadData];


            // whenevr get result
        }
        else{
            //no errors
        }


    }];
});

最佳答案

你为什么不简单地调用 reloadSections 方法而不是 [self.tableView reloadData];

[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationNone];

关于ios - [self.tableview reloadData];导致闪烁,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23312197/

相关文章:

ios - Facebook 应用程序 API key 和 UIActivityViewController

objective-c - iOS 相机 Controller 捕获 "screenshot"

java - 如何正确避免特定的 UITableViewCell 可编辑?

uitableview - iPhone,为什么 UITableView reloadData 不工作?

ios - 如何过滤 UICollectionView 并保持键盘向上?

swift - UItableView 无法快速重新加载数据

ios - Swift中的游戏中心挑战

ios - ARKit 恢复 session

java - 循环遍历tableview的列并获取单元格数据

ios - 如何快速修复 UITableCells 重复