iosobjective-cuitableviewuiviewcontrolleruirefreshcontrol

UITableView Flickering with UIRefreshControl


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?


Solution

  • 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.