Get Updates By E-mail 

Article Written By:
Johann Dowa

Create Great Looking UIButtons Quick And Easy

  •  
  •  
  •  
  •  
  •  

If you’ve used interface builder then you’ve probably noticed that you can change the colors and the actual image used for a UIView or UIButton background.  The problem with doing this is that things end looking just a bit off.  Either the corners are squared, things are off center or the other view elements just end up not looking right and you wind up either giving up or changing everything.  I found this excellent tutorial from Matt Long, co-writer of the Core Animation book on creating custom buttons and views easily that just look great.

By changing the layer attributes of the button is it possible to keep the rounded button look while changing the color, and using CAGradientLayer it is possible to add some great looking gradients.  You can see Matt’s tutorial for doing this here along with a nice sample application: Fun With UIButtons and Core Animation Layers

A useful resource for customizing the gradient effects can be found here:
The CAGradientLayer Class Reference

If you’d like to make gradient UITableView cells check out:
How To Make Ultra-Slick Gradient UITableView Cells

Hope this helps.  I like it alot better than changing the background images myself.  Please post any comments below.


  •  
  •  
  •  
  •  
  •  

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