如何选择图像的不同部分

时间:2009-07-31 06:15:38

标签: iphone

有一个显示人体骨架的.png图像。我的查询是如何在图像中选择骨骼的不同部分,如手,脚,头等,然后选择控制移动到另一个显示有关该信息的视图选定的部分。

2 个答案:

答案 0 :(得分:0)

我相信您对map代码感兴趣:

http://www.htmlcodetutorial.com/images/images_famsupp_220.html

这是另一个教程:

http://www.elated.com/articles/creating-image-maps/

第二个展示了如何将地图区域链接到JavaScript,以便您可以在页面上动态显示信息。

答案 1 :(得分: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
}