Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 8. Controls > Building Custom Buttons

Building Custom Buttons

When using the UIButtonTypeCustom style, you supply all button art. The number of images depends on how you want the button to work. For a simple push button, you might add a single background image and vary the label color to highlight when the button is pushed. For a toggle-style button, you might use four images: for the “off” state in a normal presentation, the “off” state when highlighted (that is, pressed), and two more for the “on” state. You choose and design the interaction details.

Recipe 8-1 builds a button that toggles on and off, demonstrating the detail that goes into building custom buttons. When tapped, the button switches its art from green to red, or red to green. This allows your (noncolorblind) users to instantly identify a current state. Figure 8-1 (left) shows the button created by this recipe.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial