View Full Version : scrollRowToVisible: question

Feb 24, 2009, 10:29 AM

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!

Feb 24, 2009, 10:39 AM
Use awakeFromNib in your controller.

Feb 24, 2009, 01:54 PM
Thanks! That worked perfectly. I knew it had to be something easy :)