- (void)viewDidLoad{
//scroller properties
scroller.contentSize = CGSizeMake(1300, 130);
scroller.scrollEnabled = YES;
scroller.directionalLockEnabled =YES;
scroller.frame = CGRectMake(0, 874, 768, 130);
UILongPressGestureRecognizer *longPress =
[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressed:)];
[image1 addGestureRecognizer:longPress];
[image2 addGestureRecognizer:longPress];
[image3 addGestureRecognizer:longPress];
[longPress release];
}
-(void)longPressed:(UILongPressGestureRecognizer *)sender {
CGPoint location = [sender locationInView:self.view];
if(CGRectContainsPoint(image1.frame, location)) {
NSLog(@"image1 has been longpressed");
// do something
}
if(CGRectContainsPoint(image2.frame, location)) {
NSLog(@"image2 has been longpressed");
// do something
}
if(CGRectContainsPoint(image3.frame, location)) {
NSLog(@"image3 has been longpressed");
// do something
}
else {
NSLog(@"fail");
}