One menu item for switching between two states in the WatchKit context menu

I set up the Menu and Menu Item in the Storyboard and want one menu item to switch between two states, for example. on / off, celcius / fahrenheit etc.

However, controlling drag and drop from a menu item to an interface controller does not allow me to create a socket, but it only has the ability to create an action. Therefore, although I can configure the action to switch between the two states, I cannot change its title and image to show the current state of the button.

Is there a way to implement this correctly in WatchKit?

+4
source share
1 answer

Yes, you can do it this way - whenever you want to switch your state - clear the menu items:

[self clearAllMenuItems];

and then configure the new menu items:

[self addMenuItemWithImageNamed:@"myImage" title:@"action title" action:@selector(actionMethod)];

+2
source

All Articles