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
     
  • 相关阅读:
    找到搜索的北了
    zoj2741Offside
    hdu: 1426 ( Sudoku Killer )
    悲剧的矩阵乘法
    UVa729 The Hamming Distance Problem
    hdu 1584 蜘蛛牌
    zoj2972Hurdles of 110m
    hdu 1372 ( Knight Moves ) BFS
    UVa193Graph Coloring
    zjut1624序列问题
  • 原文地址:https://www.cnblogs.com/buakaw/p/5113823.html
Copyright © 2011-2022 走看看