从阵列的图像 [英] images from an array

查看:187
本文介绍了从阵列的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个NSMutableArray,我添加了它的一个图像。还我创造,我想显示从数组中图像的ImageView的,我试图用animationImages但我没有什么事,我该如何解决?
这里是我的code:

i create an nsmutableArray and i add for it an images. also i create an imageView that i want to show the images from the array, i tried to use animationImages but i nothing is happened, how can i fix it? here is my code:

    //Numbers images
    UIImage *numberZero = [UIImage imageNamed:@"numberZero.png"];
    UIImage *numberOne = [UIImage imageNamed:@"numberOne.png"];
    UIImage *numberTwo = [UIImage imageNamed:@"numberTwo.png"];
    UIImage *numberThree = [UIImage imageNamed:@"numberThree.png"];
    UIImage *numberFour = [UIImage imageNamed:@"numberFour.png"];
    UIImage *numberFive = [UIImage imageNamed:@"numberFive.png"];
    UIImage *numberSix = [UIImage imageNamed:@"numberSix.png"];
    UIImage *numberSeven = [UIImage imageNamed:@"numberSeven.png"];
    UIImage *numberEight = [UIImage imageNamed:@"numberEight.png"];
    UIImage *numberNine = [UIImage imageNamed:@"numberNine.png"];

    //add numbers uiimage to numbersArray
    numbersArray = [NSMutableArray arrayWithObjects:numberZero, numberOne, numberTwo, numberThree, numberFour, numberFive, numberSix, numberSeven, numberEight, numberNine, nil];


    imgview1 = [[UIImageView alloc] init];
    imgview1.animationImages = numbersArray;
    imgview1.animationDuration = 2;
    imgview1.animationRepeatCount=0;
    [imgview1 startAnimating];
    [imgview1 stopAnimating];

谢谢!

推荐答案

我认为是什么都没有发生你的意思是,你看到的第一个形象,但该序列不动不止于此。

I assume that by "nothing happened" you mean that you see the first image, but the sequence does not move beyond that.

这可能是因为你 stopAnimating 太早:它甚至没有得到一个机会来启动

This is probably because you stopAnimating too soon: it does not even get a chance to start!

这篇关于从阵列的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆