1

I have a method which call the another view. i want to call this method after the image is continuously for a definite time.

This type of method found in UIButton = touchDown(),touchup().

Is there any method in touch event to find continuous touch in image view.

Pls help me.

thanks in advance

R_RKumawat
  • 133
  • 15

3 Answers3

0

You can use these events for UIIMAGEVIEW:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event 
Shehzad Bilal
  • 2,535
  • 2
  • 18
  • 27
0

assuming you want to count the touch (continous like double tap)

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];

int index =[touch view].tag;

if (touch.tapCount == number && index == imageTag) {

}

}

tapCount will be the count of tap in continues time with a very short time interval (double tap). you cannot use it if the count of tap you want to watch has longer delay (say 5 single taps). alternatively, you can remember the touches for your imageview, something like:

 - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
      UITouch *touch = [[event allTouches] anyObject];
      int index =[touch view].tag;

      if(index == imagetag){
         if([tempMutableArray count] < definiteTime){
            [tempMutableArray addObject:@"any"]
           }else{ 
            [tempMutablArray removeAllObjects]; 
            //you can call the method now
            }
      }
}
janusfidel
  • 8,036
  • 4
  • 30
  • 53
0

You can use the tap gesture which you can see the answer i wrote in this thread.In this you can set the number of taps which needs to fire the event.Hope this helps you.

Community
  • 1
  • 1
Mathew Varghese
  • 4,527
  • 2
  • 17
  • 26