The scenario is:
There is a view which has a button that takes user to another view. In the viewDidLoad of the next viewcontroller, a huge XML file gets downloaded, parsed and displayed on the screen. This way, I get the data already displayed on the screen when the view is navigated to it.
The problem is:
When I click on the button that calls the viewcontroller with parsing in it, the application becomes unresponsive. As soon as all the data is downloaded and parsed, the application moves to the next view. Now, I want to show an activity indicator on the click of that button till the time the application is being unresponsive. As soon as the view navigates to the other one, the activity indicator should stop. I tried putting activity indicator in the viewDidLoad of the ViewController I want to land to but to no avail.
PS: I can’t do the parsing in the “viewWillAppear” because of some restrictions due to the nature of application.
Looking forward to the replies.
You should do any major work that doesn’t involve the UI in a background queue/thread.
Using GCD, that might look something like this: