开发者

How to show a "loading" buttonless AlertView while performing REST requests

I'm trying to do the following:

  1. show a buttonless UIAlertView showing a "开发者_开发技巧Loading" message
  2. perform a REST request like

    currentPlans = [RestUtils restSynchnonousCall:url
                                  usingMethod:@"GET"
                                     withBody:nil];

  3. dismissing the UIAlertView

  4. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜