My UIRefreshControl gets stuck after switching tabs. This only happens on the first tab. Inside the TabBar, I have 2 tabs with a UIViewControler, inside which I have a UITableView.
I tried all the proposed solutions HERE and no one worked for me.
Below I do.
- (void)viewDidLoad { [super viewDidLoad]; data = [[NSMutableArray alloc] initWithArray:[[DataCache sharedCache] getData]]; [self addNavBar]; [self addDataTable]; //for refreshing the table data UITableViewController *tableViewController = [[UITableViewController alloc] init]; tableViewController.tableView = dataTable; refreshControl = [[UIRefreshControl alloc] init]; refreshControl.backgroundColor = [UIColor purpleColor]; refreshControl.tintColor = [UIColor whiteColor]; [refreshControl addTarget:self action:@selector(refresh) forControlEvents:UIControlEventValueChanged]; [dataTable addSubview:refreshControl]; tableViewController.refreshControl = refreshControl; } - (void)refresh { [self loadSentData]; data = [[NSMutableArray alloc] initWithArray:[[DataCache sharedCache] getSentData]]; [self performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO]; } - (void)reloadData{ [dataTable reloadData]; [refreshControl endRefreshing]; }
source share