IBOutlet UIActivityIndicatorView *indicator; [indicator startAnimating];
IBOutlet UIActivityIndicatorView *indicator; [indicator stopAnimating];
- (IBAction)btnStart:(id)sender { if(![indicator isAnimating]) { [indicator setHidden:FALSE]; [indicator startAnimating]; } } - (IBAction)btnStop:(id)sender { if([indicator isAnimating]) { [indicator stopAnimating]; [indicator setHidden:TRUE]; } }
// // ViewController.h // indicatorApp // // Created by Weerachai on 11/10/55 BE. // Copyright (c) 2555 Weerachai. All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UIViewController { IBOutlet UIActivityIndicatorView *indicator; } - (IBAction)btnStart:(id)sender; - (IBAction)btnStop:(id)sender; @end
// // ViewController.m // indicatorApp // // Created by Weerachai on 11/10/55 BE. // Copyright (c) 2555 Weerachai. All rights reserved. // #import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } - (IBAction)btnStart:(id)sender { if(![indicator isAnimating]) { [indicator setHidden:FALSE]; [indicator startAnimating]; } } - (IBAction)btnStop:(id)sender { if([indicator isAnimating]) { [indicator stopAnimating]; [indicator setHidden:TRUE]; } } - (void)dealloc { [indicator release]; [super dealloc]; } @end
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท