2

I have images I have embedded into a UIScrollView object. The scrollView's orientation is horizontal scrolling only, and paging is enabled to scroll through one picture at a time. I want to be able to make the image show up full screen via another class when the user clicks on the image(like on Facebook). The question is,how do I differentiate between a tap to the image vs a scroll? I want it to scroll when the user pans the view and blow up to full screen view when they tap it. Any suggestions?

4

1 に答える 1

1

Add a tab gesture recognizer to your UIScrollView object, and capture tap gestures through it.

This is how you add a tap recognizer to your view:

UITapGestureRecognizer * recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onTap:)];
recognizer.delegate = self;
[myScrollView addGestureRecognizer:recognizer];

This is what the onTap method signature looks like:

- (IBAction)onTap:(UIPanGestureRecognizer *)recognizer {
    // Make image show up full screen
}
于 2012-07-26T22:03:02.427 に答える