I have an issue where my Moda开发者_如何学JAVAl view that I load, takes quite a bit to show up.. I am making no service calls.. It is just trying to process some local XML data and load the view. I would like to show an activity till I see my view take up the screen. Is there a way I can know when the view is gonna appear. viewWillAppear sounds right, but how do I use it to Notify the modal presenter?
Any help would be great!
Without more detail about your implementation, it is not easy to answer properly.
Generally speaking, your view controller could keep a pointer to the object responsible for starting the activity indicator and send it a message when ready (from viewDidAppear, if everything is set so). Or, the notification could go through the parent controller to the view controller.
What I would do, is having a UIActivityIndicatorView as a subview of the "slow" view and displayed during the xml processing. So everything is managed through the same view controller; when the data is ready, you remove the indicator subview, and it's done.
精彩评论