• 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
plist -> popup menu
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

plist -> popup menu


  • Subject: plist -> popup menu
  • From: Koen van der Drift <email@hidden>
  • Date: Sat, 17 May 2003 08:06:01 -0400

Hi,


I have some problems with loading the items in a NSPopupMenu from a plist.
I have the items in a plist because the user can modify the items in the
popup.

To load the items from the plist into the popup menu I do the following:



itemsDict = [NSDictionary dictionaryWithContentsOfFile:
[[NSBundle mainBundle] pathForResource:@"items" ofType:@"plist"]];

[itemsDict retain];

[myPopup removeAllItems];
items = [[NSArray alloc] initWithArray: [itemsDict allKeys]];

e = [items objectEnumerator];

while ( item = [e nextObject] )
[myPopup addItemWithTitle:item];

[items release];


So far, so good. When the user selects an item, I get the coresponding data
from the itemsDict and use that.

The problem is the order of the items in the popup. In the Property List
Editor they are ordered alphabetically, but in the popup they are not. Is
there a way I can control the order of the items in the popup?

thanks,

- Koen.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: plist -> popup menu
      • From: Angela Brett <email@hidden>
  • Prev by Date: Re: full-screen window?
  • Next by Date: Re: plist -> popup menu
  • Previous by thread: OT: Italian Cocoa Developers Group
  • Next by thread: Re: plist -> popup menu
  • Index(es):
    • Date
    • Thread