How to prevent short freeze view
i am creating an app like the "PageControl" example from Apple, however, the info from my view's are downloaded from a server, and sometimes when the connection is poor i got those short freeze view.
My view's UI are created in a .xib file, and populated when the data is downloaded.
There is any way to show the page empty with just an activity, until all the info are downloade开发者_运维百科d??
Thanks
Do your requests Asynchronously.
If it were me, I would look at using ASIHTTPRequest http://allseeing-i.com/ASIHTTPRequest/ because I think it is a great library for doing http for the iPhone. You can set a selector to be called when your particular request is finished. So I would put a UIActivityIndicatorView on the view (with hide when stopped checked in IB), startAnimating, kick off the request, when the request returns, call stopAnimating and set all of your properties for your view.
Either you do as cdasher suggested, or you run the download process in a separate thread, with
[target performSelectorInBackground:@selector(foo)];
remember then to update your UI in the main thread with performselectoronmainthread
精彩评论