Resolved NSArrayController and table view

Discussion in 'Mac Programming' started by C. Alan, Sep 2, 2014.

  1. C. Alan, Sep 2, 2014
    Last edited: Sep 3, 2014

    C. Alan macrumors 6502

    Jan 23, 2009
    I am learning Cocoa Programming by working my way through the Big Nerd Ranch book, " Cocoa Programming for Mac OS X", forth edition. The book is a bit dated, but it is still teaching me the basics.

    So my questions:
    1. I am trying to set up a table view that is controlled by an instance of NSArrayConroller. My table view has two columns, and I would like to make it selectable, but only allow the user to edit the item in the first column. How can I lock the second column against editing?

    2. Is there an NSArrayController delegate or method that I can use to be alerted when the user makes an edit to the table?

    C. Alan
  2. briloronmacrumo, Sep 2, 2014
    Last edited: Sep 2, 2014

    briloronmacrumo macrumors 6502


    Jan 25, 2008
    Look at the Attributes inspector for the table column and NSTableViewDelegate

    Two ways ( both ultimately doing the same thing ):

    (1) In the nib for the table column just deselect the "editable" checkbox in the Attributes Inspector


    (2) Use the setEditable: method on the table column when the table appears

    NSTableViewDelegate provides NSTableView objects a way to intercept many common user actions. All you have to do is implement the delegate method. Apple's docs are here:
  3. C. Alan thread starter macrumors 6502

    Jan 23, 2009
    Thanks for the help. I didn't think to look at the Table View delegates.

Share This Page