Interface builder - binding things

Discussion in 'Mac Programming' started by GregX999, Apr 28, 2009.

  1. GregX999 macrumors newbie


    Apr 5, 2009
    Hey guys,

    I've been learning the whole "programming Cocoa" thing and I'm getting a bit confused about bindings. A few questions about Interface Builder:

    1. What's the difference between a view and its cell? (ie: When you drag a new Text Field onto a window, you get a "Text Field", and inside that, a "Text Field Cell". Which one do you bind if you want the text field to display text based on an object?) Why are there two things instead of just one?

    2. Say you have an array of objects (each object has a name and description) and an array controller bound to that array. Say you have a Table View with a list of the objects' names (bound to the array controller). Say you also have a text field. If you select an object from the table view, how do you get the text field to display the description of the selected object - and change when the selection changes?
  2. larkost macrumors 6502a

    Oct 13, 2007
    1. Its all about reusability. NSCells can be plopped down in a lot of places, but NSTextField inherits a lot of abilities from NSControl and NSResponder. By having the two different classes combined together you can carry the same behavior a lot of places.

    2. This is the perfect place to use NSArray controllers and Cocoa bindings.

Share This Page