0
votes

Got an NSOutlineView that is configured in the controller's awakeFromNib, with a datasource and autosaved expanded nodes.

All working like a charm.

The problem is that somewhere, somebody is saving the state of the scroll position, too.

This means that at launch of the app, the outline view can appear scrolled to the bottom - if that was how the user left it last (this is on Lion if it matters).

What is the best way to open the app with the outline view scrolled to the top? Preferably in awakeFromNib, or at least so the user won't be seeing a scroll movement.

2

2 Answers

1
votes

I recently started having problems with my NSOutlineView being scrolled down (so that I couldn't see my elements until I scrolled up), and I used this method :

In my applicationDidLaunch: method I use this :

[outlineView scrollPoint:NSMakePoint(0.0f, [outlineView frame].size.height)];

And it seems to work. (I also had the same problem on an IKImageBrowserView, and the same piece of code worked on that too) Hope this solution suites you better ^^

1
votes

What about [outlineView scrollToVisible:0]; ?