码迷,mamicode.com
首页 > 其他好文 > 详细

UIImageView

时间:2016-01-08 17:07:24      阅读:209      评论:0      收藏:0      [点我收藏+]

标签:

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.
  • 运行截图
    技术分享
 

UIImageView

标签:

原文地址:http://www.cnblogs.com/buakaw/p/5113823.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!