Showing posts with label menu. Show all posts
Showing posts with label menu. Show all posts

Sunday, September 6, 2009

Menus with cocos2d

If you intend to use the Menu class in cocos2d, remember that each method used as an invocation target by a MenuItem must take exactly one argument which is going to receive the object that invoked the method. If you don't conform to this, you will see an error message like:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSInvocation setArgument:atIndex:]: index (2) out of bounds [-1, 1]'

Here's a sample method that will work:

- (void) doMenuItemAction: (id) sender;