Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

teeming

macrumors newbie
Original poster
Dec 26, 2010
2
0
Hi all,

I plan to do multiple images fade in/out using UIImageView just like Flicker iphone app.

Here are the steps:
1. Load pic1.
2. pic1 move from left to right.
3. pic1 will slowly turn to become transparent while still moving.
4. Same time pic2 is moving from right to left.

I am managed to have the pic1 slowly fading out after it stop moving and pic2 move in at the same time. However what i want is to have the pic1 slowly fading out while it is still moving.

Can anybody help me to look at my code below: Thanks.

- (void)viewDidLoad {
[super viewDidLoad];

CGPoint newLeftCenter = CGPointMake(180, 240);
[UIView beginAnimations:mad:"move1" context:NULL];
[UIView setAnimationDuration:6.0f];

[UIView setAnimationCurve:UIViewAnimationTransitionFlipFromRight];

[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:mad:selector(movingStop:finished:context:)];

pic1.center = newLeftCenter;
[UIView commitAnimations];


}
- (void)movingStop:(NSString*)animationID finished:(BOOL)finished context:(void *)context {


if ( [animationID isEqualToString:mad:"move1"] ) {

CGPoint newLeftCenter = CGPointMake(200, 260);
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationCurve:UIViewAnimationTransitionFlipFromLeft];

[UIView setAnimationDuration:3.0];

pic2.alpha = 1.0;

pic2.center = newLeftCenter;
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:selector(movingStop:finished:context:)];

[UIView commitAnimations];

}
 
Here is how I fade alpha in viewDidLoad.

Code:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDelay:1.0];
[UIView setAnimationDuration:1.0];
pic1.alpha = 0.0;
[UIView commitAnimations];

Nick
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.