标签:
UIImageView
常用属性
@property (nullable, nonatomic, strong) UIImage *image; // default is nil
@property (nonatomic, getter=isUserInteractionEnabled) BOOL userInteractionEnabled; // default is NO
@property (nullable, nonatomic, copy) NSArray<UIImage *> *animationImages;
@property (nonatomic) NSTimeInterval animationDuration;
@property (nonatomic) NSInteger animationRepeatCount; // 0 表示无限次
方法
1.- (void)startAnimating;
2.- (void)stopAnimating;
3.- (BOOL)isAnimating;
---
1.UIImageView *iv = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
2. iv.center = self.view.center;
3.
4. iv.image = [UIImage imageNamed:@"block"];
5.
6. iv.userInteractionEnabled = YES;
7.
8.
9. iv.animationImages = @[[UIImage imageNamed:@"block"],
10. [UIImage imageNamed:@"flyingkick"],
11. [UIImage imageNamed:@"highkick"],
12. [UIImage imageNamed:@"punch"]];
13. iv.animationDuration = 1.0f;
14. iv.animationRepeatCount = 0; // 0 表示重复无限次
15.
16.
17. [self.view addSubview:iv];
18.
19. [iv startAnimating];
20.
标签:
原文地址:http://www.cnblogs.com/buakaw/p/5113823.html