Created
June 17, 2009 03:24
-
-
Save akio0911/131059 to your computer and use it in GitHub Desktop.
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
// @interface MyLayer : Layer | |
- (BOOL)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event | |
{ | |
UITouch *touch = [touches anyObject]; | |
CGPoint touchLocation = [touch locationInView: [touch view]]; | |
touchLocation = [[Director sharedDirector] convertCoordinate: touchLocation]; | |
CGPoint location = ccp(touchLocation.x, touchLocation.y); | |
CGRect rect = CGRectMake(self.position.x - SIZE / 2, self.position.y - SIZE / 2, SIZE, SIZE); | |
if(CGRectContainsPoint(rect, location)){ | |
// タップされた時の処理をここに書く | |
return kEventHandled; | |
}else{ | |
return kEventIgnored; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment