Last active
December 10, 2015 16:28
-
-
Save sdabet/4460746 to your computer and use it in GitHub Desktop.
Implementation of ScalableMenuItemImage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation ScalableMenuItemImage | |
+(id) itemWithNormalImage: (NSString*)value selectedImage:(NSString*) value2 disabledImage: (NSString*) value3 target:(id) t selector:(SEL) s { | |
return [[[self alloc] initWithNormalImage:value selectedImage:value2 disabledImage:value3 target:t selector:s] autorelease]; | |
} | |
+(id) itemWithNormalImage: (NSString*)value selectedImage:(NSString*) value2 disabledImage:(NSString*) value3 block:(void(^)(id sender))block { | |
return [[[self alloc] initWithNormalImage:value selectedImage:value2 disabledImage:value3 block:block] autorelease]; | |
} | |
-(void) selected { | |
[super selected]; | |
[self runAction:[CCScaleTo actionWithDuration:0.05 scale:1.2]]; | |
} | |
-(void) unselected { | |
[super unselected]; | |
[self runAction:[CCScaleTo actionWithDuration:0.05 scale:1.0]]; | |
} | |
-(void) activate { | |
// Scale out item before running normal click behaviour | |
[self runAction:[CCSequence actions: | |
[CCScaleTo actionWithDuration:0.15 scale:0], | |
[CCDelayTime actionWithDuration:0.02], | |
[CCCallBlock actionWithBlock:^(void) { [super activate]; }], | |
nil | |
]]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment