Re: The simplest way to fade out a view
Re: The simplest way to fade out a view
- Subject: Re: The simplest way to fade out a view
- From: Nick <email@hidden>
- Date: Fri, 20 May 2011 22:26:31 +0300
Chase,
the animation itself worked and works - either with your code or with
Gustavo's.
But after the animation finishes, the opaqueness of the view again becomes
1.0 again. Then the "animationDidStop" gets called and the view disappears.
But before disappearing, it annoyingly blinks (so, the opaqueness changes
like this: 1.0, 0.9, 0.8, ..., 0.1, *1.0*, hidden).
I am wondering *how could i make it save the final state of the animation* -
to remain transparent when the "animationDidStop" callback gets called -
which will allow the view not to blink.
I understand (i hope i do :-) ) that i am actually changing the opaqueness
of the layer (i.e., of the temporary graphical representation) and not of
the view itself, but maybe i could get rid of blinking somehow.
Thank you!
2011/5/20 Chase Latta <email@hidden>:
>> How could i force the animation to actually change the alpha value
>> from 1.0 to 0.0 and make it stay 0.0 unless i change it back?
>
> Change your code to look like this:
>
> CABasicAnimation * alphaAnimation = ...
> ...
> [[theView layer] setOpacity:0.0]; // Set your opacity here
> [[theView layer] addAnimation:alphaAnimation forKey:@"opacity"];
> // Note the key
> }
>
> By setting the key to @"opacity" instead of @"opacityAnimation" your
> animation will used instead of the default animation when you call
> [CALayer setOpacity:].
>
> There is a good WWDC talk about animation on the ipad that addresses
> this. I don't remember the exact talk, though.
>
> Chase
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden