uchicago-mobi / 2015-Winter-Forum

8 stars 1 forks source link

refreshControl in ViewWillAppear #94

Closed xiaoyifan closed 9 years ago

xiaoyifan commented 9 years ago

when I tried to init UIRefreshControl and do the refresh job in viewWillAppear, it didn't work. And it works in viewDidLoad. And there appears a hint in console like:" attempting to change the refresh control while it is not idle is strongly discouraged. " I'm kinda confused. Can anyone help me to explain that?

tabinks commented 9 years ago

viewWillAppear is called every time the view controller come on screen (e.g. from changing tabs). If you add a refresh control here, you will add one every time you switch to this view controller. You should put it in viewDidLoad because it will only ever be called once, and you only ever need one refresh controller.

xiaoyifan commented 9 years ago

Got it ! Thanks!