• 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: Selecting an object of a NSArrayController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Selecting an object of a NSArrayController


  • Subject: Re: Selecting an object of a NSArrayController
  • From: William Turner <email@hidden>
  • Date: Fri, 4 Jan 2008 11:52:23 -0800

One option would be to fetch objects matching your criteria (attribute == 1) and then [myArrayController setSelectedObjects:fetchResults];

Wil

On Jan 4, 2008, at 11:41 AM, Hank Heijink wrote:

Since there's only one entity that can be YES, you'd be faster and less memory-consuming if you just stored the index of the element that has YES, instead of storing YES/NO for every element and then having to find the right one.

On Jan 4, 2008, at 2:32 PM, Michael Varlik wrote:

Hi,

I have an NSArrayController which controles entities.
These entities have a boolean attribute and there is
exactly one entitie where this attribute is YES, all
the others are NO. When I want to select the one entity
with the attribute set to YES, I iterate through the
NSArrayController's arrangedObjects and when I find
the entity, I call setSelectionIndex to the index of
the object within arrangedObjects.
This works pretty good, but I wonder if there is a more
convenient way to perform this, something like
"selectObjectWithValueForKey". Is there a way to do
this?

Many thanks in advance,
Michael
--
GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/ freemail
_______________________________________________


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


Hank Heijink email@hidden



_______________________________________________

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

_______________________________________________

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


  • Follow-Ups:
    • Re: Selecting an object of a NSArrayController
      • From: "Michael Varlik" <email@hidden>
References: 
 >Selecting an object of a NSArrayController (From: "Michael Varlik" <email@hidden>)
 >Re: Selecting an object of a NSArrayController (From: Hank Heijink <email@hidden>)

  • Prev by Date: Re: Circular initialization of controllers in NIB file
  • Next by Date: Re: Custom field editors
  • Previous by thread: Re: Selecting an object of a NSArrayController
  • Next by thread: Re: Selecting an object of a NSArrayController
  • Index(es):
    • Date
    • Thread