0

我有一个 UIScrollView 。我有一个 ImageView。

我想得到 UITOUCH 点。

我知道我可以通过

- (void)handleTap:(UITapGestureRecognizer *)tapRecognizer
{
   CGPoint touchPoint = [tapRecognizer locationInView: _tileMap]
}

但我想要图像上的uitouch。

请帮我。

4

1 回答 1

0

试试这样

- (void)handleTap:(UITapGestureRecognizer *)tapRecognizer
{
    CGPoint touchPoint = [tapRecognizer locationInView: tapRecognizer.view]
}

并将图像视图设置userInteractionEnabledYES

     UIImageView *image = [[UIImageView alloc]init];
    image.frame = CGRectMake(55, 30, 50, 40);
    image.image = [UIImage imageNamed:@"Default.png"];
    UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
    singleTap.numberOfTapsRequired = 1;
    self.view.tag =10;
    image.userInteractionEnabled = YES;
    [image addGestureRecognizer:singleTap];
于 2013-10-31T10:36:16.000 回答