I am using an NSPopUpButtonCell
in an NSTableView
. The popup button has a binding to an NSArray
property offered by the ApplicationDelegate
. When I select a menu item of the popup button I expect to retrieve the current selection or its index . I added an IBAction to being informed and also set up an NSMenuDelegate
. Both return index = 0 at all times.
// indexOfSelectedItem is always 0.
NSInteger indexOfSelectedItem = [m_popUpButtonCell indexOfSelectedItem];
I created an example project with the aforementioned configuration. Hopefully you can clarify things.
The article Implementing To-One Relationships Using Pop-Up Menus answered my question.
I updated the example project .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.