UIImageview不是iOS 7中的动画,但在iOS 6中运行良好

时间:2013-09-25 06:07:51

标签: iphone ios animation uiimageview ios7

revealImgView.animationImages =[NSArray arrayWithObjects:[UIImage imageNamed:@"reveal1.png"],[UIImage imageNamed:@"reveal2.png"],[UIImage imageNamed:@"reveal3.png"],[UIImage imageNamed:@"reveal4.png"],[UIImage imageNamed:@"reveal5.png"],nil];
revealImgView.animationDuration=1.5;
revealImgView.animationRepeatCount=INFINITY;
[revealImgView startAnimating];

这在iOS 6中运行良好但不适用于iOS 7.我已经在nib中制作了UIImageView

1 个答案:

答案 0 :(得分:5)

它应该可以工作,如果在一段时间后没有调用该方法,

        double delayInSeconds = 0.5;
        dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
        dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
            [self getAllImgViewAnimating];
        });


    -(void)getAllImgViewAnimating
    {
    revealImgView.animationImages =[NSArray arrayWithObjects:[UIImage imageNamed:@"reveal1.png"],[UIImage imageNamed:@"reveal2.png"],[UIImage imageNamed:@"reveal3.png"],[UIImage imageNamed:@"reveal4.png"],[UIImage imageNamed:@"reveal5.png"],nil];
    revealImgView.animationDuration=1.5;
    revealImgView.animationRepeatCount=INFINITY;
    [revealImgView startAnimating];
    }