Cocoa Programming for OS X: The Big Nerd Ranch Guide
by Aaron Hillegass, Adam Preble, Nate Chandler
Configuring RaiseMan’s Remove Button
Now that your array controller knows what the user has selected in the table view, you can use the array controller to ensure that the Remove button is only enabled when appropriate – when the array controller has an object selected. This will prevent your users from clicking Remove when they have not selected an employee to remove.
You will bind the button’s enabled property
to the array controller’s canRemove property.
This property is true only
when the array controller can actually do removal.
In other words, this property will be false
when the array controller does not have any objects selected.
To set up this binding, select the Remove button and switch to the bindings inspector. In the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access