问题是 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/