2009-07-31 9 views
0

人体の骨格を表示する.png画像があります。私の質問は、画像内の手、足、頭などの骨格の異なる部分を選択する方法です。その選択されたパーツに関する情報を表示する別のビューに移動します。画像の異なる部分を選択する方法

答えて

0

私はおそらくUIImageViewをサブクラス化し、上書きしたいtouchesEnded:withEvent:

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event 
{ 
    // ignore if more than one finger 
    if ([touches count] != 1) { 
     [self.nextResponder touchesEnded:touches withEvent:event]; 
     return; 
    } 

    UITouch *touch = [touches anyObject]; // there's only one object in the set 

    // ignore unless the user lifted the finger off the screen 
    if (touch.phase != UITouchPhaseEnded) { 
     [self.nextResponder touchesEnded:touches withEvent:event]; 
     return; 
    } 

    // ignore if double-touch or more 
    if ([touch tapCount] != 1) { 
     [self.nextResponder touchesEnded:touches withEvent:event]; 
     return; 
    } 

    CGPoint locationOfTouch = [touch locationInView:self]; 

    // TODO: use locationOfTouch.x and locationOfTouch.y to determine which part has been selected 
}