Version: 1.0

Posted: 2007-10-30

Build Requirements: Xcode 2.4.1, Mac OS X 10.4.x

Runtime Requirements: Mac OS X 10.4.x

View Source Code:

Download Sample (“ButtonMadness.zip”, 107.8K)
Download Sample (“ButtonMadness.dmg”, 167.6K)



Description

ButtonMadness is a Cocoa application that demonstrates how to use the various type of buttons. It demonstrates two approaches: creating buttons using Interface Builder and creating the same buttons using code.

Apple recommends that you design your application with Interface Builder whenever possible. However, you may need to create controls in code when the makeup of your UI is not fully known until runtime. This sample shows both approaches as it gives you an idea of the "magic" that goes on behind the scenes in Interface Builder: creating the standard UI elements, affecting their behavior and attributes, and setting their target/action connections. As an added bonus, a special Objective-C category is introduced to show how to un-select all segments of an NSSegmentedControl.

Document Revision History

Date Notes
2007-10-30Demonstrates how to use the various types of buttons using a nib file or programatically.

Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.