scrollRowToVisible: question

Discussion in 'Mac Programming' started by sigjuice, Feb 24, 2009.

  1. sigjuice
    Expand Collapse
    macrumors member

    Mar 14, 2008

    I need an NSTableView to remember its contents and selected row in
    User Defaults. I can get this to work using these bindings

    mytableview.content <-> myarraycontroller.arrangedObjects <-> Shared
    User Defaults Controller.somearray

    mytableview.selectionIndexes <-> myarraycontroller.selectionIndexes
    <-> Shared User Defaults Controller.someint (via an
    integer-to-NSIndexSet value transformer)

    When the tableview appears, I'd like the selected row to scroll and
    become visible. It appears that
    scrollRowToVisible: will do this for me, but I cannot figure out where
    to insert the call to this method. None of the NSTableView delegate
    methods look suitable. Maybe I need to subclass NSTableView, but
    again, I'm not sure what method I need to override.

    Thanks in advance for any suggestions!
  2. kainjow
    Expand Collapse
    Moderator emeritus


    Jun 15, 2000
  3. sigjuice
    Expand Collapse
    thread starter macrumors member

    Mar 14, 2008
    Thanks! That worked perfectly. I knew it had to be something easy :)

Share This Page