I have an app with a UINavigationController with a tabBarController and quite a few views.
My two main views, that correspond to the two tabs, both show a nice MBProgressHUD when they are loading data. This is triggered from viewDidLoad and only intended to be visible once. Subsequent refreshes from the server do not use MBProgressHUD.
The problem is, viewDidLoad is being called again in certain situations. I believe this is because the view is unloaded because of memory constraints and then reloaded later, which triggers the code I only want to run on the first time.
My question: how can I ensure this is only called the first time they load the view, without trying to store a temporary count somewhere. All of my solutions seem horribly hacky. 🙂
Thanks!
in view controller:
in init:
in viewDidLoad: