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

Mockup & CodeGen, iPhone & iPad
($9.99)

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

Manu
($0.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 03-09-2009, 02:24 AM   #1 (permalink)
New Member
 
Join Date: Mar 2009
Posts: 1
Default UIImageView alpha fade animation issue

I'm a newbie iPhone developer - going very well, almost finished my first app minus this one issue which I am a little embarrassed to be asking but...

I have a UIImageView that I have animated to fade (alpha value) over the period of 60s. After the animation a UIButton displays. In addition by tapping you can force the alpha value of the UIImageView down as to make the animation appear faster. But I am having trouble determining when the alpha value of my UIImageView is below zero - so that I can display the button - even though the animation is still running. Here is my code:

Code:
- (void)fadeTheImageView
{
	[fadeImageView setAlpha:1.0];

	[UIView beginAnimations:@"theAnimation" context:NULL];
	[UIView setAnimationDelegate:self];
	[UIView setAnimationDidStopSelector:@selector(yourAnimationHasFinished:finished:context:)];
	[UIView setAnimationDuration:10];
	[fadeImageView setAlpha:0.0];
	[UIView commitAnimations];	
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
	if ( fadeImageView.alpha <= 0.0 ) {
		[saveButton setHidden:NO];
	}
	[fadeImageView setAlpha:(fadeImageView.alpha - 0.1)];
}

- (void)yourAnimationHasFinished:(NSString *)animationID finished:(BOOL)finished context:(void *)context;
{
	[saveButton setHidden:NO];
}
The error is with the - if ( fadeImageView.alpha <= 0.0 ) {
incompatible variable types.
I've tried everything.

Any help would be appreciated
nicksayes is offline   Reply With Quote
Old 04-24-2009, 11:02 AM   #2 (permalink)
New Member
 
Join Date: Apr 2009
Posts: 1
Default

This is terribly inefficient, but it might help.

If you are having problems with number type compatibility, package both into the NSNumber class and use it's compare methods.

something like

if ( NSOrderedAscending == [[NSNumber numberWithDouble:fadeImageView.alpha] compare:[NSNumber numberWithDouble:1.0]){

I don't know why your code isn't working, but this might make the compiler word the error differently if it's a problem somewhere else.
unvjarhead is offline   Reply With Quote
Reply

Bookmarks

Tags
alpha, animation, iphone, 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
» Stats
Members: 158,311
Threads: 89,034
Posts: 379,818
Top Poster: BrianSlick (7,086)
Welcome to our newest member, ramonpadillas
Powered by vBadvanced CMPS v3.1.0

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