Re: User Defaults
Re: User Defaults
- Subject: Re: User Defaults
- From: Kaspar Fischer <email@hidden>
- Date: Fri, 11 Nov 2005 11:31:30 +0100
On 10.11.2005, at 22:27, alex gordillo wrote:
I have an NSTableView (one column only) that is dynamically
populated with an array of web services. I'm trying to use
NSUserDefaults so that it remembers the last row selected. I don't
want to do it using the row index numbers because the number of
items could possibly change every time the app is launched, so I
figure I must do it by the name of the object in the row. In my
awakeFromNib method, I'm trying to write the method that reads the
default and sets the tableview to the current setting. I don't
know how I can set a selected row using an object name and not the
row index. Any help would be appreciated.
Looks like you have to enumerate all rows of the table
and compare each with the special name from the user
defaults...
So I would send a -arrangeObjects: method to the controller
that is contolling the NSTableView's content. Then I'd
enumerate all elements of the array returned by -arrangeObjects
using
file:///Developer/ADC Reference Library/documentation/Cocoa/
Reference/Foundation/ObjC_classic/Classes/NSArray.html#//apple_ref/
doc/uid/20000137-BABCDDIC
One you have found the one whose name coincides with the
special name from the user defaults, you use the controller's
-setSelectionIndexes: (or one of the other selection routines)
to set the selection appropriately.
Hope this helps,
Kaspar
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden