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
  • 相关阅读:
    SQL优化之博客案例
    Drools之规则属性
    Android 8.0以上系统应用如何保活
    Android 8.0(api27)静态广播和动态广播接收问题
    Android开发 WorkManager详解
    使用EOS Camera Movie Record 软件在计算机上使用 Canon EOS DSLR相机录制视频 。
    关于使用AlarmManager的注意事项
    系统服务之定时服务(AlarmManager)
    Android定时器AlarmManager
    Android 代码混淆
  • 原文地址:https://www.cnblogs.com/iQingYang/p/5193204.html
Copyright © 2011-2022 走看看