Recipe: Building 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 pushbutton, 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, making sure to add local state (the Boolean
isOn instance variable in Recipe 2-1) to extend a simple pushbutton to a toggle. If you supply a normal image to buttons and do not specify highlight or disabled images, iOS automatically ...