如何动画像它的形象。例如:在天空中移动。苹果手机

时间:2012-05-30 10:44:49

标签: iphone ios macos ipad sdk

如何为图片制作动画,使其看起来像是朝向用户。例如:在天空中移动

2 个答案:

答案 0 :(得分:1)

请查看此解决方案

-(IBAction)showSignInView:(id)sender{
    signInView.hidden = NO;
    [self initialDelayEnded:Your View ];
}
-(void)initialDelayEnded:(UIView *)view {
    view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.3, 0.3);
    view.alpha = 1.0;
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:kTransitionDuration/1.5];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(bounce1AnimationStopped:)];
    view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.1, 1.1);
    [UIView commitAnimations];
}

- (void)bounce1AnimationStopped:(UIView *)view {
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:kTransitionDuration/2];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(bounce2AnimationStopped:)];
    view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.0, 1.0);
    [UIView commitAnimations];
}

- (void)bounce2AnimationStopped:(UIView *)view {
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:kTransitionDuration/2];
    view.transform = CGAffineTransformIdentity;
    [UIView commitAnimations];
}

答案 1 :(得分:0)

使用淡入和淡出动画图像 -

- (IBAction)showHideView:(id)sender
{
// Fade out the view right away
[UIView animateWithDuration:1.0
    delay: 0.0
    options: UIViewAnimationOptionCurveEaseIn
    animations:^{
         imageView.alpha = 0.0;
    }
    completion:^(BOOL finished){
        // Wait one second and then fade in the view
        [UIView animateWithDuration:1.0
             delay: 1.0
             options:UIViewAnimationOptionCurveEaseOut
             animations:^{
                imageView.alpha = 1.0;
             }
             completion:nil];
    }];
}

请参阅 - http://developer.apple.com/library/ios/#documentation/windowsviews/conceptual/viewpg_iphoneos/animatingviews/animatingviews.html