![]() |
cocos2d-iphone
2.1
Improved Cocos2D API Reference (iOS version) for www.kobold2d.com developers
|
#import <CCMenuItem.h>
Public Member Functions | |
(id) | - initWithTarget:selector: |
(id) | - initWithBlock: |
(CGRect) | - rect |
(void) | - activate |
(void) | - selected |
(void) | - unselected |
(void) | - setIsEnabled: |
(BOOL) | - isEnabled |
(void) | - setBlock: |
(void) | - setTarget:selector: |
(void) | - cleanup |
Static Public Member Functions | |
(id) | + itemWithTarget:selector: |
(id) | + itemWithBlock: |
Protected Attributes | |
void(^ | _block )(id sender) |
BOOL | _isEnabled |
BOOL | _isSelected |
BOOL | _releaseBlockAtCleanup |
Properties | |
BOOL | isSelected |
BOOL | releaseBlockAtCleanup |
CCMenuItem base class
Subclass CCMenuItem (or any subclass) to create your custom CCMenuItem objects.
- (void) activate |
Activate the item
- (void) cleanup |
cleanup event. It will release the block and call [super cleanup]
Implements CCNode.
- (id) initWithBlock: | (id sender) | block |
Initializes a CCMenuItem with the specified block. The block will be "copied".
- (id) initWithTarget: | (id) | target | |
selector: | (SEL) | selector | |
Initializes a CCMenuItem with a target/selector
- (BOOL) isEnabled |
Returns whether or not the CCMenuItem is enabled
+ (id) itemWithBlock: | (id sender) | block |
Creates a CCMenuItem with the specified block. The block will be "copied".
+ (id) itemWithTarget: | (id) | target | |
selector: | (SEL) | selector | |
Creates a CCMenuItem with a target/selector. target/selector will be implemented using blocks. "target" won't be retained.
- (CGRect) rect |
Returns the outside box in points
- (void) selected |
The item was selected (not activated), similar to "mouse-over"
- (void) setBlock: | (id sender) | block |
Sets the block that is called when the item is tapped. The block will be "copied".
- (void) setIsEnabled: | (BOOL) | enabled |
Enable or disabled the CCMenuItem
Implemented in CCMenuItemLabel.
- (void) setTarget: | (id) | target | |
selector: | (SEL) | selector | |
Sets the target and selector that is called when the item is tapped. target/selector will be implemented using blocks. "target" won't be retained.
- (void) unselected |
The item was unselected
- (BOOL) isSelected [read, assign] |
returns whether or not the item is selected
- (BOOL) releaseBlockAtCleanup [read, write, assign] |
If enabled, it releases the block at cleanup time.