Get Updates By E-mail 

Article Written By:
Johann Dowa

Code Snippet: Easy fading iPhone buttons, images, views

  •  
  •  
  •  
  •  
  •  

I was asked by a friend working on their first iPhone app if I could show them how to fade buttons to provide the user with visual feedback.  So I came up with this quick iPhone development tutorial using some source code that is actually from the second app that we I will be showing how to build in my iPhone development videos.

A very quick demonstration of the effect is shown in this video:

Fading a view on the iPhone is very easy you simply specify the ending alpha value, and duration, and commit the animations.  The views will then fade to the chosen alpha value.  Overall it’s a pretty sweet way to fade buttons, and images used in your interface especially if you’ve had to go through more complex techniques.

The code for the two methods to create the buttons is shown here: Source Code Snippet Fading Images, And Buttons On The iPhone

That’s all there is to it, it’s very plug and play so all you have to do is run the methods to perform the effect., and I’ve included some sample code with a project that has various views fading in and out based on which button is selected.  With a little bit of playing around you can make flashing images/buttons etc. 

The completed project can be downloaded here: >>> FadingViews <<<


  •  
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments