I have aUITableView
withUIRefreshControl
defined inside the viewDidLoad:
method of aUIViewController
as below:
- (void)viewDidLoad {
[super viewDidLoad];
self.refreshControl = [[UIRefreshControl alloc] init];
[self.refreshControl addTarget:self action:@selector(refreshMessages) forControlEvents:UIControlEventValueChanged];
UITableViewController *tableViewController = [[UITableViewController alloc] init];
tableViewController.tableView = self.messagesTableView;
tableViewController.refreshControl = self.refreshControl;
}
- (void)refreshMessages {
//load data items
if ([self.refreshControl isRefreshing]) {
[self.refreshControl endRefreshing];
}
[self.messagesTableView reloadData];
}
I use self sizing cell to update the cell data. On re-loading the data theUITableView
flickers. Is there a way to avoid this?
Edit
I have linked the video file for a sample demo. The UITableView
on reload data, flickers. I use autolayout to update the dynamic cell heights.
Here is a sample code that can recreate this issue. The UITableView should be pulled to refresh. The table view is reloaded on the main queue. The cell are being resized with autolayout.
Swift
You may want to use
extendedLayoutIncludesOpaqueBars = true
in your ViewController in order to have correct UIRefreshControl animation.
I guess the issue is using estimatedHeight & UITableViewAutomaticDimension along with uitableview's reloadData. This has been reported here
The delay would work but its still not the right way to achieve it unless you want a hackish work around.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With