您的位置:首页 > 产品设计 > UI/UE

iOS控件使用之UIActivityIndicatorView

2015-01-04 23:23 375 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息