// Handles the start of a touch - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSUInteger numTaps = [[touches anyObject] tapCount]; // ==> 현재 터치되어있는 수를 구하는 코드 // ...중략 // Enumerate through all the touch objects. NSUInteger touchCount = 0;
for (UITouch *touch in touches) {
// Send to the dispatch method, which will make sure the appropriate subview is acted upon [self dispatchFirstTouchAtPoint:[touch locationInView:self] forEvent:nil]; // ==> 모든 터치에 대해, 터치 위치와 이벤트 등에 따라 처리해줍니다. touchCount++; } } -(void) dispatchFirstTouchAtPoint:(CGPoint)touchPoint forEvent:(UIEvent *)event { // ...생략-_- }
이놈 까지 봤으니 이후는 더더욱 설명할 것이 없을 것입니다.
// Handles the continuation of a touch. - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
// ...생략
// Enumerates through all touch objects for (UITouch *touch in touches) {
// Send to the dispatch method, which will make sure the appropriate subview is acted upon [self dispatchTouchEvent:[touch view] toPosition:[touch locationInView:self]]; } // ...생략 } -(void) dispatchTouchEvent:(UIView *)theView toPosition:(CGPoint)position { // ...생략 }
// Handles the end of a touch event. - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { // Enumerates through all touch object for (UITouch *touch in touches){ // Sends to the dispatch method, which will make sure the appropriate subview is acted upon [self dispatchTouchEndEvent:[touch view] toPosition:[touch locationInView:self]]; } } -(void) dispatchTouchEndEvent:(UIView *)theView toPosition:(CGPoint)position { // ...생략 } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { // Enumerates through all touch object for (UITouch *touch in touches){ // Sends to the dispatch method, which will make sure the appropriate subview is acted upon [self dispatchTouchEndEvent:[touch view] toPosition:[touch locationInView:self]]; } }
'DEV life > DEV.mobile' 카테고리의 다른 글
SKT의 앱스토어, 성공할까? (26) | 2009.04.14 |
---|---|
2D 프레임버퍼의 제어 (2) | 2009.04.07 |
날로 먹는 iPhone dev 일기 #1 (2) | 2009.04.01 |
날로 먹는 iPhone dev 일기 #0 (2) | 2009.03.30 |
게임 플랫폼으로서의 iPhone (2) | 2009.03.24 |