zoukankan      html  css  js  c++  java
  • UI基础 UIIMageView

    #import "RootViewController.h"
    
    @interface RootViewController ()
    
    @end
    
    @implementation RootViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
    
        //UIImageView 负责显示图片的类
        UIImageView* imageV=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 375, 667)];
    
        imageV.backgroundColor=[UIColor yellowColor];
        [self.view addSubview:imageV];
        //创建一个图片
        UIImage *ima=[UIImage imageNamed:@"a.jpg"];
        //显示
        imageV.image=ima;
        
        //逐帧动画
        //设置要播放的资源 (这些资源是图片 并且这些图片放到数组中)
        NSMutableArray* array=[NSMutableArray array];
        for(int i=0;i<=80;i++){
            //创建80张图片并添加到一个数组中  drink_%d.jpg 指文件路径下
            NSString* name=[NSString stringWithFormat:@"a.jpg"];
            UIImage *image=[UIImage imageNamed:name];
            [array addObject:image];
        }
        NSLog(@"%@",array);
        imageV.animationImages=array;
        //设置动画时间
        imageV.animationDuration=3;
        //设置重复次数
        imageV.animationRepeatCount=2;
        
        //启动动画
        [imageV startAnimating];
        
     
    }
    
    
    @end
  • 相关阅读:
    资料网站
    HTML、CSS部分
    面试题三
    面试题二
    面试题一
    上学时的HTML+JS+CSS(小总结)
    01.策略模式-上篇
    【解决方案】HTTP could not register URL http://+:6001/
    【问题与思考】1+"1"=?
    WCF安全3-Transport与Message安全模式
  • 原文地址:https://www.cnblogs.com/zhangqing979797/p/13342118.html
Copyright © 2011-2022 走看看