Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a button fade after clicked for iOS / xcode?

Tags:

ios

uibutton

I want to make a button fade away after it is clicked. I know that I can use

_myButon.hidden = TRUE;

...to completely hide a button, but it feels abrupt and jarring. I also know I could sequentially lower the alpha or something, but wasn't sure how to make this happen automatically over a short period of time.

Can someone please give me a tip how to fade out a button after it is clicked using the simplest means possible? I want the effect to look something like a simple "Fade-out" from a powerpoint presentation or something :)

Thanks!

like image 747
jake9115 Avatar asked Dec 07 '22 06:12

jake9115


1 Answers

[UIView animateWithDuration:0.5 animations:^{
    _myButton.alpha = 0;
}];
like image 160
Khanh Nguyen Avatar answered Jan 05 '23 11:01

Khanh Nguyen