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

exactlygaming

macrumors newbie
Original poster
Aug 1, 2011
4
0
so i am trying to have multiple images shown in sequence so it looks as if the image is getting brighter then darker, i had it just getting bright but now when i add the getting dark it only gets darker and the first part is skipped here is the code, please help thanks!

Code:
@implementation IntroViewController
@synthesize imageview;

-(void)viewDidLoad {
	
	imageview.animationImages = [NSArray arrayWithObjects:
								 [UIImage imageNamed:@"eg1.1.jpg"],
								 [UIImage imageNamed:@"eg1.2.jpg"],
								 [UIImage imageNamed:@"eg1.3.jpg"],
								 [UIImage imageNamed:@"eg1.4.jpg"],
								 [UIImage imageNamed:@"eg1.5.jpg"],
								 [UIImage imageNamed:@"eg1.6.jpg"],
								 [UIImage imageNamed:@"eg1.7.jpg"],
								 [UIImage imageNamed:@"eg1.8.jpg"],
								 [UIImage imageNamed:@"eg1.9.jpg"],
								 [UIImage imageNamed:@"eg2.0.jpg"],
								 [UIImage imageNamed:@"eg2.1.jpg"],
								 [UIImage imageNamed:@"eg2.2.jpg"],
								 [UIImage imageNamed:@"eg2.3.jpg"],
								 [UIImage imageNamed:@"eg2.4.jpg"],
								 [UIImage imageNamed:@"eg2.5.jpg"],
								 [UIImage imageNamed:@"eg2.6.jpg"],
								 [UIImage imageNamed:@"eg2.7.jpg"],
								 [UIImage imageNamed:@"eg2.8.jpg"],
								 [UIImage imageNamed:@"eg2.9.jpg"],
								 [UIImage imageNamed:@"eg3.0.jpg"],
								 [UIImage imageNamed:@"eg3.1.jpg"],
								 [UIImage imageNamed:@"eg3.2.jpg"],
								 [UIImage imageNamed:@"eg3.3.jpg"],
								 [UIImage imageNamed:@"eg3.4.jpg"],
								 [UIImage imageNamed:@"eg3.5.jpg"],
								 [UIImage imageNamed:@"eg3.6.jpg"],
								 [UIImage imageNamed:@"eg3.7.jpg"],
								 [UIImage imageNamed:@"eg3.8.jpg"],
								 [UIImage imageNamed:@"eg3.9.jpg"],
								 [UIImage imageNamed:@"eg4.0.jpg"],
								 [UIImage imageNamed:@"eg4.1.jpg"], nil];
	imageview.animationDuration = 0.50;
	imageview.animationRepeatCount = 1;
	[imageview startAnimating];
	[self.view addSubview:imageview];


	imageview.animationImages = [NSArray arrayWithObjects:
								 [UIImage imageNamed:@"eg4.1.jpg"],
								 [UIImage imageNamed:@"eg4.0.jpg"],
								 [UIImage imageNamed:@"eg3.9.jpg"],
								 [UIImage imageNamed:@"eg3.8.jpg"],
								 [UIImage imageNamed:@"eg3.7.jpg"],
								 [UIImage imageNamed:@"eg3.6.jpg"],
								 [UIImage imageNamed:@"eg3.5.jpg"],
								 [UIImage imageNamed:@"eg3.4.jpg"],
								 [UIImage imageNamed:@"eg3.3.jpg"],
								 [UIImage imageNamed:@"eg3.2.jpg"],
								 [UIImage imageNamed:@"eg3.1.jpg"],
								 [UIImage imageNamed:@"eg3.0.jpg"],
								 [UIImage imageNamed:@"eg2.9.jpg"],
								 [UIImage imageNamed:@"eg2.8.jpg"],
								 [UIImage imageNamed:@"eg2.7.jpg"],
								 [UIImage imageNamed:@"eg2.6.jpg"],
								 [UIImage imageNamed:@"eg2.5.jpg"],
								 [UIImage imageNamed:@"eg2.4.jpg"],
								 [UIImage imageNamed:@"eg2.3.jpg"],
								 [UIImage imageNamed:@"eg2.2.jpg"],
								 [UIImage imageNamed:@"eg2.1.jpg"],
								 [UIImage imageNamed:@"eg2.0.jpg"],
								 [UIImage imageNamed:@"eg1.9.jpg"],
								 [UIImage imageNamed:@"eg1.8.jpg"],
								 [UIImage imageNamed:@"eg1.7.jpg"],
								 [UIImage imageNamed:@"eg1.6.jpg"],
								 [UIImage imageNamed:@"eg1.5.jpg"],
								 [UIImage imageNamed:@"eg1.4.jpg"],
								 [UIImage imageNamed:@"eg1.3.jpg"],
								 [UIImage imageNamed:@"eg1.2.jpg"],
								 [UIImage imageNamed:@"eg1.1.jpg"], nil];
	imageview.animationDuration = 02.50;
	imageview.animationRepeatCount = 1;
	[imageview startAnimating];
	[self.view addSubview:imageview];
	
}
 
Last edited by a moderator:

admanimal

macrumors 68040
Apr 22, 2005
3,531
2
The second part of your method is reached before the animation in the first part even has a chance to start, i.e. the code doesn't just stop after the first animation and wait for it to complete. So before the first animation has started, you've already switched the set of animation images and those are the ones the UIImageView ends up using to animate.
 

PatrickCocoa

macrumors 6502a
Dec 2, 2008
751
149
[UIView beginAnimations:]

The code below is in the touchesEnded method, but you could put it in your viewDidLoad method.

The first five lines set up the animation with a duration of 3 seconds (and some other stuff). The middle line then sets what the alpha of the two UIImageViews will be at the end of the 3 seconds. Then the last line commits (starts) the animation.

Cocoa will then animate from whatever the opacity of the UIImageViews currently is to whatever the value is in the variable opacityOfPictures.

One other thing, this specifies another method (didStopFirstAnimation) to call when this one finishes. That way you can do another animation in that second method if you want. It looks like you're trying to do two animations - one from bright to dark, then a second animation from dark to bright.

Have fun!

Code:
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDuration:3.0];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    [UIView setAnimationDidStopSelector:@selector(didStopFirstAnimation:)];
    
    PatrickArms.alpha =     PatrickTan.alpha =     opacityOfPictures;
    
    [UIView commitAnimations];
 

exactlygaming

macrumors newbie
Original poster
Aug 1, 2011
4
0
im still confused

sorry but im very very new to xcode and im still confused by ur code i understand the first person who responded but that doesn't helpe me fix it also with the code i pasted after the second array of images there is going to be a third and final so 3 groups of images i still don't get what i am supposed to put in between them to make them go in order
 

exactlygaming

macrumors newbie
Original poster
Aug 1, 2011
4
0
i need help please and please explain well

so i am trying to have multiple images shown in sequence so it looks as if the image is getting brighter then darker, i had it just getting bright but now when i add the getting dark it only gets darker and the first part is skipped here is the code, there also is going to be a third group like these so it will be three groups of pics of 3 sets of time, can someon please explain what i need and where to put it cuz i have no idea really how to use xcode, i just followed a video, but the video was for only one set of time and i need 3 please help thanks!

Code:
Code:
@implementation IntroViewController
@synthesize imageview;

-(void)viewDidLoad {
	
	imageview.animationImages = [NSArray arrayWithObjects:
								 [UIImage imageNamed:@"eg1.1.jpg"],
								 [UIImage imageNamed:@"eg1.2.jpg"],
								 [UIImage imageNamed:@"eg1.3.jpg"],
								 [UIImage imageNamed:@"eg1.4.jpg"],
								 [UIImage imageNamed:@"eg1.5.jpg"],
								 [UIImage imageNamed:@"eg1.6.jpg"],
								 [UIImage imageNamed:@"eg1.7.jpg"],
								 [UIImage imageNamed:@"eg1.8.jpg"],
								 [UIImage imageNamed:@"eg1.9.jpg"],
								 [UIImage imageNamed:@"eg2.0.jpg"],
								 [UIImage imageNamed:@"eg2.1.jpg"],
								 [UIImage imageNamed:@"eg2.2.jpg"],
								 [UIImage imageNamed:@"eg2.3.jpg"],
								 [UIImage imageNamed:@"eg2.4.jpg"],
								 [UIImage imageNamed:@"eg2.5.jpg"],
								 [UIImage imageNamed:@"eg2.6.jpg"],
								 [UIImage imageNamed:@"eg2.7.jpg"],
								 [UIImage imageNamed:@"eg2.8.jpg"],
								 [UIImage imageNamed:@"eg2.9.jpg"],
								 [UIImage imageNamed:@"eg3.0.jpg"],
								 [UIImage imageNamed:@"eg3.1.jpg"],
								 [UIImage imageNamed:@"eg3.2.jpg"],
								 [UIImage imageNamed:@"eg3.3.jpg"],
								 [UIImage imageNamed:@"eg3.4.jpg"],
								 [UIImage imageNamed:@"eg3.5.jpg"],
								 [UIImage imageNamed:@"eg3.6.jpg"],
								 [UIImage imageNamed:@"eg3.7.jpg"],
								 [UIImage imageNamed:@"eg3.8.jpg"],
								 [UIImage imageNamed:@"eg3.9.jpg"],
								 [UIImage imageNamed:@"eg4.0.jpg"],
								 [UIImage imageNamed:@"eg4.1.jpg"], nil];
	imageview.animationDuration = 0.50;
	imageview.animationRepeatCount = 1;
	[imageview startAnimating];
	[self.view addSubview:imageview];


	imageview.animationImages = [NSArray arrayWithObjects:
								 [UIImage imageNamed:@"eg4.1.jpg"],
								 [UIImage imageNamed:@"eg4.0.jpg"],
								 [UIImage imageNamed:@"eg3.9.jpg"],
								 [UIImage imageNamed:@"eg3.8.jpg"],
								 [UIImage imageNamed:@"eg3.7.jpg"],
								 [UIImage imageNamed:@"eg3.6.jpg"],
								 [UIImage imageNamed:@"eg3.5.jpg"],
								 [UIImage imageNamed:@"eg3.4.jpg"],
								 [UIImage imageNamed:@"eg3.3.jpg"],
								 [UIImage imageNamed:@"eg3.2.jpg"],
								 [UIImage imageNamed:@"eg3.1.jpg"],
								 [UIImage imageNamed:@"eg3.0.jpg"],
								 [UIImage imageNamed:@"eg2.9.jpg"],
								 [UIImage imageNamed:@"eg2.8.jpg"],
								 [UIImage imageNamed:@"eg2.7.jpg"],
								 [UIImage imageNamed:@"eg2.6.jpg"],
								 [UIImage imageNamed:@"eg2.5.jpg"],
								 [UIImage imageNamed:@"eg2.4.jpg"],
								 [UIImage imageNamed:@"eg2.3.jpg"],
								 [UIImage imageNamed:@"eg2.2.jpg"],
								 [UIImage imageNamed:@"eg2.1.jpg"],
								 [UIImage imageNamed:@"eg2.0.jpg"],
								 [UIImage imageNamed:@"eg1.9.jpg"],
								 [UIImage imageNamed:@"eg1.8.jpg"],
								 [UIImage imageNamed:@"eg1.7.jpg"],
								 [UIImage imageNamed:@"eg1.6.jpg"],
								 [UIImage imageNamed:@"eg1.5.jpg"],
								 [UIImage imageNamed:@"eg1.4.jpg"],
								 [UIImage imageNamed:@"eg1.3.jpg"],
								 [UIImage imageNamed:@"eg1.2.jpg"],
								 [UIImage imageNamed:@"eg1.1.jpg"], nil];
	imageview.animationDuration = 02.50;
	imageview.animationRepeatCount = 1;
	[imageview startAnimating];
	[self.view addSubview:imageview];
	
}
 
Last edited by a moderator:

balamw

Moderator emeritus
Aug 16, 2005
19,366
979
New England
i have no idea really how to use xcode, i just followed a video, but the video was for only one set of time and i need 3 please help thanks!

What video?

Can you provide a link to it, maybe that would help someone come up with an answer for you.

Can you break the problem down? Maybe using fewer pictures?

What is your programming background? Why do you expect to be able to do this at this point without learning how to use Xcode and more importantly Cocoa Touch?

EDIT: I recommend you read http://whathaveyoutried.com and http://www.mikeash.com/getting_answers.html to see how to best use the forum to get the answers you seek.

B
 
Last edited:

exactlygaming

macrumors newbie
Original poster
Aug 1, 2011
4
0
ive been having difficulty finding it again on youtube, it was a kid who made a blue screen of death app for the ipod so that one word would change back and forth, but it was 2 different images. I'll keep trying to find it but it wasn't even on my history cuz i watched it so long ago
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.