0
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {

 UITouch * t =[touches anyobject];
CGpoint * point = [t locationinview:self.view];

If([t view]) == imageview {

Imageview.center = point;

}

}
Larme
  • 24,190
  • 6
  • 51
  • 81

1 Answers1

0

Check is point inside the image rectangle:

if (CGRectContainsPoint(imageview.bounds, point)) {
    //point inside imageView frame
}

You can also set up gesture recogniser on that image view and required method will be called just user touch that specific image, for example:

-(void)viewDidLoad {
    [super viewDidLoad];
    UITapGestureRecognizer *gr = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageTouched:)];
    gr.numberOfTapsRequired = 1;
    gr.numberOfTouchesRequired = 1;
    [imageview addGestureRecognizer:gr];
}
-(void)imageTouched:(UITapGestureRecognizer*)recognizer{

    //image view touched
}
Greg
  • 25,317
  • 6
  • 53
  • 62