2012-06-01 52 views

回答

2

看看一個容易的UIView(的UIImageView)動畫tutorial

一個最酷的事情有關iPhone應用程序是如何動畫很多都是。您可以讓視圖在屏幕上飛行,淡入或淡出,旋轉以及更多! 這不僅看起來很酷,而且動畫也是很好的指標,用戶應該注意的事情正在發生,比如更多的信息可用。

2

確保導入以下框架:

#import <QuartzCore/QuartzCore.h> #import <CoreGraphics/CoreGraphics.h>

UIImageView *someImage = ..... 
CALayer *b = someImage.layer; 
// Create a keyframe animation to follow a path to the projected point 
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"scale"]; 
animation.removedOnCompletion = NO; 

// Create the path for the bounces 
CGMutablePathRef thePath = CGPathCreateMutable(); 

// Start the path at my current location 
CGPathMoveToPoint(thePath, NULL, someImage.center.x, someImage.center.y); 
CGPathAddLineToPoint(thePath, NULL,20, 500.0); 

animation.path = thePath; 

animation.speed = 0.011; 
animation.repeatCount = 1000000; 

// Add the animation to the layer 
[someImage addAnimation:animation forKey:@"move"]; 

,直到你得到你想要的結果,您可以玩的值。接受這個答案,如果這是你的解決方案。

0
- (void) showProgressView 
{ 
if (progressViewBack.frame.origin.y == 460.0) 
{ 
    [self.view bringSubviewToFront:progressViewBack]; 
    [progressViewBack setFrame:CGRectMake(6.0, 460, 308.0, 126.0)]; 
    [progressViewBack setBounds:CGRectMake(0, 0, 308, 126.0)]; 

    [UIView beginAnimations:nil context:NULL]; 
    [UIView setAnimationDuration:1.0]; 
    [UIView setAnimationDelegate:self]; 
    [progressViewBack setFrame:CGRectMake(6.0, 334.0, 308.0, 126.0)]; 
    [UIView commitAnimations]; 
} 
else if (progressViewBack.frame.origin.y == 334.0) 
{ 
    [progressViewBack setFrame:CGRectMake(6.0, 334.0, 308.0, 126.0)];  
    [progressViewBack setBounds:CGRectMake(0, 0, 308.0, 126.0)]; 

    [UIView beginAnimations:nil context:NULL]; 
    [UIView setAnimationDuration:1.0]; 
    [UIView setAnimationDelegate:self]; 
    [progressViewBack setFrame:CGRectMake(6.0, 460.0, 308.0, 126.0)]; 
    [UIView commitAnimations]; 
} 

}

相關問題