zoukankan      html  css  js  c++  java
  • UIImageView02

    UIImageView相当于⼀个相框,⽤来显⽰图⽚,⾥边可以是⼀张图⽚,也可以是⼀组图⽚
     
    //
    //  ViewController.m
    //  UIImageView 02
    //
    //  Created by cqy on 16/2/15.
    //  Copyright © 2016年 程清杨. All rights reserved.
    //

    #import "ViewController.h"

    @interface ViewController (){
        UIImageView *img;
    }

    @end

    @implementation ViewController

    - (void)viewDidLoad {
        [super viewDidLoad];
        self.view.backgroundColor = [UIColor yellowColor];
        img = [[UIImageView alloc]initWithFrame:CGRectMake(100, 100, 200, 200)];
        img.backgroundColor = [UIColor whiteColor];
        // 不要将数据写⼊view
        // 准备⼀个image的数组
        NSMutableArray *imArr = [NSMutableArray array];
        // 循环⽣成image放⼊数组
        for(int i = 1; i < 4;i++){
            NSString *nameStr = [NSString stringWithFormat:@"%d",i];
            NSLog(@"-----%d",i);
               [imArr addObject:[UIImage imageNamed:nameStr]];
            }
        //执⾏⼀组所⽤时间
        img.animationDuration = 1;
        //循环三次
        img.animationRepeatCount = 3;
        // 将image数组 赋值给animationImages
        img.animationImages = imArr;
        //开始动画
        [img startAnimating];
        //结束动画
        //[img stopAnimating];
        [self.view addSubview:img];
        // Do any additional setup after loading the view, typically from a nib.
    }

    - (void)didReceiveMemoryWarning {
        [super didReceiveMemoryWarning];
        // Dispose of any resources that can be recreated.
    }
    @end
  • 相关阅读:
    Python基础知识
    Oracle 总结
    Linux基本命令
    测试理论
    计算机基础
    http常见的状态码,400,401,403状态码分别代表什么?
    html
    day21 包
    day20 模块引入的一些说明
    我又回来了???
  • 原文地址:https://www.cnblogs.com/iQingYang/p/5193204.html
Copyright © 2011-2022 走看看