zoukankan      html  css  js  c++  java
  • IOS:利用UIImageView制作帧动画

    代码比较简单不用解释

    -(UIImageView *)singPict{
        if (!_singPict) {//
            _singPict=[[UIImageView alloc]initWithFrame:CGRectMake(screenWidth/2-140, screenHeight/2-85,280, 80)];
            _singPict.contentMode=UIViewContentModeScaleAspectFit;
            _singPict.backgroundColor=[UIColor clearColor];
            UIImage *im1 = [UIImage imageNamed:@"singPict1.png"];
            UIImage *im2 = [UIImage imageNamed:@"singPict2.png"];
            UIImage *im3 = [UIImage imageNamed:@"singPict3.png"];
            UIImage *im4 = [UIImage imageNamed:@"singPict4.png"];
            NSArray *imArr = @[im1,im2,im3,im4];
            [_singPict setAnimationImages:imArr];
            //设定动画时间
            [_singPict setAnimationDuration:0.5];
    
            //设置播放次数,0表示无限播放
            [_singPict setAnimationRepeatCount:0];
    
            //开始播放
            [_singPict startAnimating];
            //结束播放
    //        [_singPict stopAnimating];
            [self.view addSubview:_singPict];
        }
        return _singPict;
        
    }
  • 相关阅读:
    小的面试题
    email
    网络
    进程,线程
    周日作业
    Python_day9
    Python_day8
    假期作业
    12/13
    Python_day7
  • 原文地址:https://www.cnblogs.com/kc1995/p/14267803.html
Copyright © 2011-2022 走看看