iphone等待对话框编写

             在做一些耗时操作时,往往需要像Android一样的一个等待对话框,如下图所示           

                           iphone等待对话框编写_第1张图片

 主要代码:

             

-(IBAction)onClickButton:(id)sender {
	
	txtField.text = @"Hello World.";
    
    UIAlertView* alert = [[UIAlertView alloc] initWithTitle"执行中" 
                                                    message:nil
                                                   delegate:self      //
                                          cancelButtonTitle:nil 
                                          otherButtonTitles:nil, nil];
    NSLog(@"test .......");
    [alert show];
    UIActivityIndicatorView* uiaiv = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    uiaiv.center = CGPointMake(alert.bounds.size.width / 2.0f, alert.bounds.size.height/2.0f);
    [uiaiv startAnimating];
    [alert addSubview:uiaiv];
    [uiaiv release];
    [alert release];

}


 

你可能感兴趣的:(iphone等待对话框编写)