zoukankan      html  css  js  c++  java
  • 用图像列表播放动画

    技术:创建一个由UIImage组成的图片数组,然后按照序列逐帧的播放这些图片,这样看起来就类似一个动画效果:

    参考代码:

    -(IBAction)playButton:(id)sender;

    {

      CGRect rect = CGRectMake(20, 20, 100, 100);

      UIImageView *m_View = [[[UIImageView alloc] initWithFrame:rect] autorelease];

      UIImage *image1 = [UIImage imageNamed:@"picTVcar1.png"];

      UIImage *image2 = [UIImage imageNamed:@"picTVcar2.png"];

      UIImage *image3 = [UIImage imageNamed:@"picTVcar3.png"];

      UIImage *image4 = [UIImage imageNamed:@"picTVcar4.png"];

      UIImage *image5 = [UIImage imageNamed:@"picTVcar5.png"];

      UIImage *image6 = [UIImage imageNamed:@"picTVcar6.png"];

      UIImage *image7 = [UIImage imageNamed:@"picTVcar7.png"];

      UIImage *image8 = [UIImage imageNamed:@"picTVcar8.png"];

      UIImage *image9 = [UIImage imageNamed:@"picTVcar9.png"];

      UIImage *image10 = [UIImage imageNamed:@"picTVcar10.png"];

      UIImage *image11 = [UIImage imageNamed:@"picTVcar11.png"];

      UIImage *image12 = [UIImage imageNamed:@"picTVcar12.png"];

      NSArray *imageArray = [NSArray arrayWithObjects:

        image1,

        image2,

        image3,

        image4,

        image5,

        image6,

        image7,

        image8,

        image9,

        image10,

        image11,

        image12,

        nil];

      m_View.animationImages = imageArray;

      m_View.animationDuration = 1.0;

      m_View.animationRepeatCount = 0;

        [self.view addSubview:m_View];

      [m_View startAnimating];

    }

    THE END !

  • 相关阅读:
    Selenium+Chrome或Firefox的动态爬虫程序
    scrapy管道MySQL简记
    Ajax数据获取(未完待续。。。)
    如何快速识别网页是静态、动态、还是伪静态的?
    python3>日期和时间
    简单实例
    爬虫【基础篇】
    数据库的分区、分表、分库、分片的简介
    bilibili弹幕爬取与比对分析
    前端日常开发---搭建脚手架
  • 原文地址:https://www.cnblogs.com/xingchen/p/2153601.html
Copyright © 2011-2022 走看看