loading = [[UIAlertView alloc] initWithTitle:@"" message:@"Please Wait..." delegate:nil cancelButtonTitle:nil otherButtonTitles:nil]; UIActivityIndicatorView *progress= [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(125, 50, 30, 30)]; progress.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge; [loading addSubview:progress]; [progress startAnimating]; [progress release]; [loading show];
[loading dismissWithClickedButtonIndex:0 animated:YES]; [loading release];
// // ViewController.h // UIAlertViewUIActivityIndicatorView // // Created by Weerachai on 12/8/55 BE. // Copyright (c) 2555 Weerachai. All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UIViewController - (IBAction)btnOpenPopup:(id)sender; @end
// // ViewController.m // UIAlertViewUIActivityIndicatorView // // Created by Weerachai on 12/8/55 BE. // Copyright (c) 2555 Weerachai. All rights reserved. // #import "ViewController.h" @interface ViewController () { UIAlertView *loading; } @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. } - (IBAction)btnOpenPopup:(id)sender { loading = [[UIAlertView alloc] initWithTitle:@"" message:@"Please Wait..." delegate:nil cancelButtonTitle:nil otherButtonTitles:nil]; UIActivityIndicatorView *progress= [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(125, 50, 30, 30)]; progress.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge; [loading addSubview:progress]; [progress startAnimating]; [progress release]; [loading show]; // for Hide //[loading dismissWithClickedButtonIndex:0 animated:YES]; //[loading release]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท