Target-Action using Cocoa Bindings

Last Revision:
Version 1.1, 2013-04-18
Update to use ARC, Auto Layout, Base Localization, and modern Objective-C syntax (including use of properties, autosynthesis, and literals).
(Full Revision History)
Build Requirements:
Mac OS X v10.8, Xcode 4.5
Runtime Requirements:
Mac OS X v10.8

This is a simple example that illustrates how you can use Cocoa bindings to bind a button's target and action parameters.

In most situations, target/action is the appropriate pattern to use for buttons - you simply want a method to be invoked when the button is pressed. Sometimes, however, it may be convenient to use bindings to collect information from your application and pass it to the target using the method arguments, or the target itself might be selected dynamically. In these situations, using bindings may prove beneficial. In this example, the selections in the two table views are collected from their corresponding array controllers using bindings.