iOS控件使用之UIActivityIndicatorView

来源:互联网 发布:软件实施投标文件 编辑:程序博客网 时间:2024/04/20 10:06

1、.h

#import <UIKit/UIKit.h>@interface ViewController : UIViewController@property (strong, nonatomic) IBOutletCollection(UIActivityIndicatorView) NSArray *bbb;- (IBAction)myStart:(id)sender;- (IBAction)myStop:(id)sender;@end

2、.m

#import "ViewController.h"@interface ViewController ()@end@implementation ViewController- (void)viewDidLoad {    [super viewDidLoad];//    NSLog(@"%lu",(unsigned long)self.indicators.count);    // 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)myStart:(id)sender{    NSLog(@"start");    NSLog(@"%lu",self.bbb.count);    for(int i = 0 ; i < self.bbb.count ; i++)    {        [[self.bbb objectAtIndex:i] startAnimating];    }}- (IBAction)myStop:(id)sender{    NSLog(@"stop");    for(int i = 0 ; i < self.bbb.count ; i++)    {        [[self.bbb objectAtIndex:i] stopAnimating];    }}@end


0 0