多张图片合成连续动画实现(IOS)

引入

多张图片连续动画实现

方案一(代码如下:)

UIImageView* mainImageView= [[UIImageView alloc]initWithFrame:CGRectMake(00784300)];

     mainImageView.animationImages = [NSArray arrayWithObjects:   

                            [UIImage imageNamed:@"icon_main_ad0.png"],

                             [UIImageimageNamed:@"icon_main_ad1.png"],

                            [UIImageimageNamed:@"icon_main_ad2.png"],nil];

     [mainImageView setAnimationDuration:9.0f];

     [mainImageView setAnimationRepeatCount:0];

     [mainImageView startAnimating];

     [borderView addSubview:mainImageView];

    [mainImageView release];

方案二(代码如下:)

UIImage *image = [UIImage imageNamed:@"icon_main_ad0.png"];

     UIImageView *imageView = [[UIImageView alloc]initWithImage:image];

     [imageView setFrame:CGRectMake(00784300)];

     [self performSelector:@selector(changeImages:)withObject:imageView afterDelay:3.0];

     [borderView addSubview:imageView];

    [imageView release];

重点:

自己再定义一个改变图片的程序:

/*

 * @DO 改变滑动图片

 * @param imageView 滑动视图

 */

- (void) changeImages:( UIImageView *) imageView

{

     //这里是改变图片的程序代码,在此略去,然后递归调用自己

     [self performSelector:@selector(changeImages:)

              withObject: imageView

              afterDelay:3.0

      ];

}

 

你可能感兴趣的:(ios,image)