I'm using a UIRefreshControl to enable the pull-to-refresh gesture on a table view.
I have used the storyboard te setup the RefershControl and in my TableViewController is use the following code to bound the method to the RefeshControl:
self.refreshControl?.addTarget(self, action: Selector("getData"), forControlEvents: UIControlEvents.ValueChanged)
At the end of the getData() method I call the reloadData() method on the tableview and the stopRefreshing() method on the refreshcontrol.
This is working fine. I can pull to refresh and the table gets updated.
Next thing I want is to start the RefreshControl when the TableViewController gets loaded. To show the user that the app is getting the data. I tried to manually start the folowing code:
self.refreshCorntrol?.beginRefreshing()
getData()
It reloads the data but the animation is not working like it should. The table stays empty. Then when all the data is fetched the table is pulled down (like when I manually pull to refresh) en immediately pushed back up.
Anyone know if it is possible to change/fix this?