Subject: [ NSSplitview ] -setAutosaveName
Subject: [ NSSplitview ] -setAutosaveName
- Subject: Subject: [ NSSplitview ] -setAutosaveName
- From: Caleb Strockbine <email@hidden>
- Date: Sun, 31 May 2009 03:19:34 -0400
On May 31, 2009, at 12:10 AM, email@hidden wrote:
What does setAutosaveName actually do? I assume it saves the
position of the splitview to user defaults?
Did you read the fine manual? It's fairly plain:
"Sets the name under which receiver’s divider position is
automatically saved... If this value is nil or the string is empty no
autosaving is done."
So, if you set the autosave name for a split view to something other
than nil, the split view will automatically save its position using
the name that you gave it. The autosave name isn't something that
you'd normally want to change after the splitter is set up -- you set
it either in Interface Builder or in whatever code creates the
splitter, and then forget about it.
If so, how does one retrieve that value?
Typically, one doesn't. The split view will use the autosave name you
gave it to retrieve the data from the defaults system and set itself
appropriately. Your app shouldn't need to worry about the position of
the splitters themselves -- they're not controls, and they shouldn't
affect the state of your application. To whatever extent you do care
about the position of the splitters, you can/should probably rely on
the sizes of the split view's subviews instead. However, if you do
want to peek at the data that the split view is saving (for logging
purposes, perhaps), you can always retrieve the split view's data from
the defaults system yourself:
id savedData = [[NSUserDefaults standardUserDefaults] valueForKey:
[slider autosaveName]];
I used an id above because you really can't know for certain what kind
of data NSSplitView is saving. It's probably an array, since there can
be more than one splitter in a split view, but it could be something
else.
-Caleb_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden