Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re:Binding to one specific object of an NSArrayController




Hi Michael

In my application I have a submenu which represents the content of
an NSArrayController. When I add an object via the controllers add:
method a new menu item is created. But when I change the value of a
property from inside the table, this change is not reflected to the
menu items. Therefore I bound the NSArrayController's selection.name
keypath to the menu item's title when the menu item is added to the
menu. Unfortunetly selection.name is the wrong keypath, because the
title of all the menu items is the name of the selected item in the
table. So my question is: Is there a way to bind each NSMenuItem's
title to exactly one object managed by the NSArrayController?

If you think that you need to bind to individual items in the NSArrayController,
then perhaps you need to access the contents of the controller using
- (id)arrangedObjects;
This will return you the NSArray of objects maintained by the array controller.
You can iterate through this array and bind to each of the menu items.
I am not sure if this is an elegant method, but it works.


Regards
Shripada



Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.