I'm trying to do the following:
- show a buttonless UIAlertView showing a "开发者_开发技巧Loading" message
perform a REST request like
currentPlans = [RestUtils restSynchnonousCall:url usingMethod:@"GET" withBody:nil];
dismissing the UIAlertView
return currentPlans
I've looked for dispatch_async
pattern, I've also looked at this thread UIAlertView starts to show, screen dims, but it doesn't pop up until it's too late! without understanding so much... :(
Thank you in advance!
Alert view is supposed to inform something that user can cancel or ask for simple things like yes/no. For loading/connecting I suggest to use UIActivityIndicator
. Please note that changing the behavior of standard components does not comply with the human interface guidelines. User should be able to dismiss an alert view on his/her wish.
Ivan I think you need to use Activity Indicator for "Loading" process. But if you like to use button less alertview then ,use this code: UIAlertView *loadingAlert = [[UIAlertView alloc] initWithTitle:@"Loading...." message:nil delegate:nil cancelButtonTitle:nil otherButtonTitles:nil];
[loadingAlert show];
[loadingAlert release];
When ever your request is done....write this code in that delegate method: [loadingAlert dismissWithClickedButtonIndex:0 animated:YES]; This code automatically terminate your alertview. **loadingAlert must be defined inside .h file.
精彩评论