scrollRowToVisible: question

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

  1. macrumors member

    Joined:
    Mar 14, 2008
    #1
    Hi,

    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. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
  3. thread starter macrumors member

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

Share This Page