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
     
  • 相关阅读:
    爬虫 xpath
    Mongo 基础命令
    大数据 Spark 连接外部资源
    大数据 Spark 异常
    大数据 Spark 安装
    python 对象克隆
    一个Vue表单提交防抖的实用例子
    一个防抖和节流的实用例子
    前端面试100问(1-10)
    每日技术:encodeURI,encodeURIComponent,toFixed
  • 原文地址:https://www.cnblogs.com/buakaw/p/5113823.html
Copyright © 2011-2022 走看看