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
  • 相关阅读:
    解析HTTP协议六种请求方法
    金蝶
    普元
    中间件
    [CTSC2008] 网络管理
    【Uva 10498】满意值
    【SPOJ839】最优标号
    bzoj2879 [Noi2012]美食节
    bzoj3144 [Hnoi2013]切糕
    bzoj3112 [Zjoi2013]防守战线
  • 原文地址:https://www.cnblogs.com/iQingYang/p/5193204.html
Copyright © 2011-2022 走看看