I use this code to beginRefreshing for the first time i visit my UIViewController
var refreshControl = UIRefreshControl()
refreshControl.addTarget(self, action: #selector(self.loadPlayer), for: .valueChanged)
self.playersTable.addSubview(refreshControl)
self.refreshControl.beginRefreshing()
self.loadPlayer()
function loadPlayer is called and the spinner is shown, but the problem is the spinner does not animating at all, and it looks bad. Any solution to trigger RefreshControl valueChanged?
I have tried another code like this but didn`t work
self.refreshControl.layoutIfNeeded()
self.refreshControl.beginRefreshing()
self.playersTable.setContentOffset(CGPoint(x: 0, y: -self.refreshControl.frame.size.height), animated: true)
i know i could use UIActivityIndicatorView and only show it for the first time, but could i use only UIRefreshControl for efficiency ?
Had the exact same problem - what worked for me is to put the
self.refreshControl.beginRefreshing()
insideviewWillAppear
-- (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [self.refreshController beginRefreshing]; }