I added an infinite scrolling feature and realized that whenever I reload the uitableview, the view flickers..I am not sure how to fix the flickering at this point. Please h
y you are using deleteRowsAtIndex? If you reload table all table delegate methods are called. I think it is taking time to delete all rows and then again reload. Just use reload method and try.
Below code worked for me like a charm!
Objective-C
[UIView performWithoutAnimation:^{
[self.tableview reloadData];
[self.tableview beginUpdates];
[self.tableview endUpdates];
}];
Swift 4
UIView.performWithoutAnimation {
self.tableView.reloadData()
self.tableView.beginUpdates()
self.tableView.endUpdates()
}
Just in case all other answers do not solve your problem, I post my solution.
If you use estimated height estimatedSectionHeaderHeight
or estimatedRowHeight
or -(CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath
, and with dynamic row count for each section (e.g. expandable two level tableView)
you should stop using this and implement -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
to return the correct height.