Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 04-16-2010, 08:16 PM   #1 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 2
nnhubbard is on a distinguished road
Default Fade image in and out multiple times using Alpha

I am trying to fade an image in and out for 6 seconds, so there would be 3 fade outs, and 3 fade ins, one second long each. I have tried the following, but it does not work:

Code:
[UIView beginAnimations:nil context:NULL];
	[UIView setAnimationDuration:1.0];
	venomTitle.alpha = 1.0;
	[UIView commitAnimations];
	
	[UIView beginAnimations:nil context:NULL];
	[UIView setAnimationDuration:1.0];
	venomTitle.alpha = 0.0;
	[UIView commitAnimations];
	
	[UIView beginAnimations:nil context:NULL];
	[UIView setAnimationDuration:1.0];
	venomTitle.alpha = 1.0;
	[UIView commitAnimations];
	
	[UIView beginAnimations:nil context:NULL];
	[UIView setAnimationDuration:1.0];
	venomTitle.alpha = 0.0;
	[UIView commitAnimations];
	
	[UIView beginAnimations:nil context:NULL];
	[UIView setAnimationDuration:1.0];
	venomTitle.alpha = 1.0;
	[UIView commitAnimations];
	
	[UIView beginAnimations:nil context:NULL];
	[UIView setAnimationDuration:1.0];
	venomTitle.alpha = 0.0;
	[UIView commitAnimations];
Is there a method of doing this? I am using UIImageView.
nnhubbard is offline   Reply With Quote
Old 04-16-2010, 09:36 PM   #2 (permalink)
Registered Member
 
Join Date: Apr 2008
Posts: 339
Delirium is an unknown quantity at this point
Default

Those are all going to get jumbled together into one animation. You need to separate them with a timer. You could do this by several calls to performSelector, with each one firing a little bit after the next, with a call to your animations inside methods.

[self performSelector:@selector(doAnimationFadeIn) withObject:venomTitle afterDelay:0.0];
[self performSelector:@selector(doAnimationFadeOut) withObject:venomTitle afterDelay:1.0];
[self performSelector:@selector(doAnimationFadeIn) withObject:venomTitle afterDelay:2.0];
...
etc.
Delirium is offline   Reply With Quote
Reply

Bookmarks

Tags
alpha, animation, fade, uiimageview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 315
16 members and 299 guests
chemistry, Domele, Duncan C, Fstuff, givensur, heshiming, HowEver, iAppDeveloper, iphonedevshani, jbro, JoeRCruso, kapps11, newDev, SLIC, stanny, WheyLabs
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,648
Threads: 94,112
Posts: 402,874
Top Poster: BrianSlick (7,990)
Welcome to our newest member, brandon6031
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 07:28 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0