Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IOS: set alpha in a UIImage

I have an UIImage and I want to set its alpha at 0.00 after 3 seconds... In my UIImage there is a picture that I want to immediately see when I go in a view, but after 3 second it must disappear.

like image 387
cyclingIsBetter Avatar asked Sep 20 '11 16:09

cyclingIsBetter


1 Answers

Easy as that using core animation

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:3.0f];
imageView.alpha = 0.0f;
[UIView commitAnimations];

if you dont want to slowly fade within 3 seconds, you can use

[UIView setAnimationDelay:3];

and reduce the animation duraction to 0.5f or something. i think using a short fade out time feels better than just simply set hide to YES

like image 74
roman Avatar answered Sep 18 '22 12:09

roman