开发者

IOS linked and continuous animation like Flipboard app's first view

开发者 https://www.devze.com 2023-03-15 22:00 出处:网络
Here is my code: - (void)showother{ backgroundA.alpha = 1.0; backgroundB.alpha = 0.0; [UIView beginAnimations:@\"ken\" context:NULL];

Here is my code:

- (void)showother{
    backgroundA.alpha = 1.0;
    backgroundB.alpha = 0.0;

    [UIView beginAnimations:@"ken" context:NULL];
    [UIView setAnimationDuration:4];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
    [UIView setAnimationDidStopSelector:@selector(showHideDidStop)];
    CGAffineTransform rotate = CGAffineTransformMakeRotation(0.00);
    CGAffineTransform moveLeft = CGAffineTransformMakeTranslation(0.9,0.9);
    CGAffineTransform combo1 = CGAffineTransformConcat(rotate, moveLeft);

    CGAffineTransform zoomOut = CGAffineTransformMakeScale(1.5,1.5);
    CGAffineTransform transform = CGAffineTransformConcat(zoomOut, combo1);
    backgroundA.transform = transform;
    [UIView commitAnimations];
}

- (void)showHideDidStop{

    [UIView beginAnimations:@"fade" context:NULL];
    [UIView setAnimationDuration:4];
    backgroundA.alpha = 0.0;
    backgroundB.alpha = 1.0;
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(showother)];
    [UIView commitAnimations];

    backgroundA.image = [backgroundImageQueue objectAtIndex:0];
    backgroundB.image = [backgroundImageQueue objectAtIndex:[backgroundImageQueue count] - 1];
    [backgroundImageQueue insertObject:backgroundB.image atIndex:0];
    [backgroundImageQueue removeLastObject];
}        

First iteration of the animation works fine, but later only the second animation runs开发者_如何转开发. Where can be the problem?

0

精彩评论

暂无评论...
验证码 换一张
取 消