Note that there are some explanatory texts on larger screens.

plurals
  1. POUITableView UIRefreshControl Does Not Show Its View The First Time
    text
    copied!<p>I have added the functionality of UIRefreshControl in my project that uses a UITableView. The app works by fetching entries from a web service to a tableview. Below is the code i have used to add UIRefreshControl:</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init]; refreshControl.tintColor = [UIColor grayColor]; refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:@"Updating New Entries"]; [refreshControl addTarget:self action:@selector(pullToRefresh) forControlEvents:UIControlEventValueChanged]; self.refreshControl = refreshControl; [self pullToRefresh]; } - (void) pullToRefresh { counter = 1; [self fetchEntriesNew:counter]; // My code for updating table view [self performSelector:@selector(updateTable) withObject:nil afterDelay:2]; } - (void)updateTable { [self.tableView reloadData]; [self.refreshControl endRefreshing]; } </code></pre> <p>Now if i pull to refresh, it refreshes by adding new entries if there are any and shows me the following view on top of the tableview:</p> <p><img src="https://i.stack.imgur.com/ghzvO.jpg" alt="enter image description here"></p> <p>Everything works great except when the app is launched or opened for the very first time, it does not show the view that i have showed in the above image, although it does refreshes the tableview. I want it to show the refresh control view every time it refreshes it. Can anyone point out what i am doing wrong? Thanks!</p> <p><strong>UPDATE:</strong> I have added [self refreshControl beginRefreshing] and the UIRefreshControl's spinner view is now showing but its above the first entry of the tableview. Can anyone point out how to correct it?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload