• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: User Defaults
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: User Defaults


  • Subject: Re: User Defaults
  • From: alex gordillo <email@hidden>
  • Date: Wed, 16 Nov 2005 12:28:36 -0500

I got it working now.  Thanks for the advice.

On Nov 11, 2005, at 5:31 AM, Kaspar Fischer wrote:

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:
40maccontrol.com


This email sent to email@hidden


_______________________________________________ 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
References: 
 >User Defaults (From: alex gordillo <email@hidden>)
 >Re: User Defaults (From: Kaspar Fischer <email@hidden>)

  • Prev by Date: NSTreeController and Panther
  • Next by Date: Re: NSTreeController and Panther
  • Previous by thread: Re: User Defaults
  • Next by thread: Re: refreshing the header title for an NSTableColumn [fixed!]
  • Index(es):
    • Date
    • Thread