plist -> popup menu
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.