IOS Uialertview in Uiactivityindicatorview wheel prompt load wait

Source: Internet
Author: User

Reference: Http://stackoverflow.com/questions/18729220/uialertview-addsubview-in-ios7

1. SignInViewController.h

#import <UIKit/UIKit.h> @interface signinviewcontroller:uiviewcontroller<uialertviewdelegate>{    Uialertview *remotealertview;} @end

2 , SIGNINVIEWCONTROLLER.M

#import "SignInViewController.h" @interface Signiniewcontroller () @end @implementation signinviewcontroller-(void)    dealloc{if (remotealertview) {[Remotealertview release]; } [Super Dealloc];}    In the method://Remote WebService method Remotelogic *remotelogic = [[Remotelogic alloc] init];    Start animation [self remoteanimation:@ "getting server time, please wait ..."];        Asynchronously loading Data Dispatch_async (Dispatch_get_global_queue (dispatch_queue_priority_default, 0), ^{//Get WebService data        Delegate.servertime = Remotelogic.getservertime; Dispatch_async (Dispatch_get_main_queue (), ^{//Turn off animation [Remotealertview Dismisswithclickedbuttonindex:            0 Animated:yes];    Get WebService data after operation do something}); }); #pragma mark-animation-(void) Remoteanimation: (NSString *) message{if (Remotealertview) {[Remotealertview R    Elease]; } Remotealertview = [[Uialertview alloc] initwithtitle:@ "hint" message:message delegate:self cancelbuttontitle:nil Other ButtontitLes:nil, nil];    Uiactivityindicatorview *aiview = [[Uiactivityindicatorview alloc] Initwithframe:cgrectmake (125.0, 80.0, 30.0, 30.0)];    Aiview.activityindicatorviewstyle = Uiactivityindicatorviewstylewhitelarge; Check if OS version is 7 or above. ios7.0 and above Uialertview deprecated the Addsubview method if ([[[Uidevice Currentdevice] systemversion] compare:@ "7.0"]! =    nsorderedascending) {[Remotealertview setvalue:aiview forkey:@ "Accessoryview"];    }else{[Remotealertview Addsubview:aiview];    } [Remotealertview show];    [Aiview startanimating]; [Aiview release];}

3. Effect ios5.1,ios7.1.2



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.