Sync state of two NSMenuItems
I have two NSMenus
with the same NSMenuItems
. Only one NSMenuItem
in its NSMenu
should be selected. (Kind of like an NSMatrix
). So I connected each NSMenuItem
to the same action and added an iVar for the index of the item with the NSOnState
. Inside the method I set the state of the item with the old index to NSOffState
and the new one to NSOnState
, then I set the old index to the new index. This works just fine for one of the two NSMenus
. But I开发者_如何学Go would like to sync them both. I can add IBOutlets for every NSMenu and then set the states inside the method since I have access to both NSMenus
. But this feels kind of redundant.. Note: I'm also planning to save the index in the user defaults so maybe it can be achieved by an NSUserDefaultsController
?
Nevermind. I think I'll just code everything myself without bindings etc.
精彩评论