What's the rule of thumb if I want to change observed object's sin开发者_运维知识库gle property from different menu items (think - list of options).
E.g. I have an app that displays a car in a single window. I have a menu with menu item that says [Colors] with few submenu items like [Black, Green, Blue, Red, White, etc.]. How do I implement the mechanism behind this so that each submenu item changes same property (in this case - color) to different values.
If you're using target-action (IBAction) just point the menu at the same method in the same object and have the method make the appropiate changes.
If you're using bindings, then you set the keypath to the same attribute.
精彩评论