zoukankan      html  css  js  c++  java
  • 使用YYAnimatedImageView加载GIF图,并且可以控制只播放一次

    1.初始化YYAnimatedImageView
    YYAnimatedImageView *imageView = [[YYAnimatedImageView alloc] init];
    imageView.backgroundColor = [UIColor whiteColor];
    imageView.contentMode = UIViewContentModeScaleAspectFit;
    [self.view addSubview:imageView];

    2.加载网络GIF图片
    [imageView yy_setImageWithURL:[NSURL URLWithString:@"gif图url链接"] placeholder:[UIImage imageNamed:@"default"]];

    3.通过RAC或者自己写观察者,观察currentAnimatedImageIndex播放到什么位置,如果播放到最后一张图,则停止播放
    [RACObserve(imageView, currentAnimatedImageIndex) subscribeNext:^(id _Nullable x) {
    if ([x integerValue] == imageView.animationImages.count) {
    [_imageView stopAnimating];
    }
    }];

  • 相关阅读:
    HDU 2094 产生冠军
    CodeForce 837 A/B/C解题报告
    HDU 4825 Xor Sum 【01字典树】
    Kruskal 最小生成树
    并查集
    ccf 201812-4
    Prim 最小生成树
    ccf 201812-1
    ccf 201812-2
    getline()
  • 原文地址:https://www.cnblogs.com/dbaiyunyun/p/7927693.html
Copyright © 2011-2022 走看看