Get Updates By E-mail 

uibutton

Creating Custom Shaped UIButtons

  •  
  •  
  •  
  •  
  •  

Creating custom shaped buttons is something done in many iPhone apps.  Often times this is done through using a completely custom button class, however, it can be done through subclassing UIButton allowing for much easier implementation.

Jeff Lamarche illustrates this technique here: Irregularly Shaped UIButtons

Ole Begemann has also created a custom button class which he talks about here: OBShapedButton: Non-rectangular buttons on the iPhone.

[Source: Jeff LaMarche’s Blog, Ole Begemann’s Blog]


  •  
  •  
  •  
  •  
  •  

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.


  •  
  •  
  •  
  •  
  •