zoukankan      html  css  js  c++  java
  • UIImageView

    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.
    • 运行截图
      Alt text
     
  • 相关阅读:
    移动端尺寸基础知识
    flex
    Viewport
    移动端Web开发技巧
    vue项目中,Iview打包到生产环境时, woff 字体引用问题
    【读书笔记】iOS-垃圾回收
    【读书笔记】iOS-Coco内存管理规则-拥有对象
    【读书笔记】iOS-自动释放池
    【读书笔记】iOS-引用计数
    【读书笔记】iOS-装箱
  • 原文地址:https://www.cnblogs.com/buakaw/p/5113823.html
Copyright © 2011-2022 走看看