Add double tap action (presentModalViewController) to UISCOLLVIEW
- by R.J.
I have been wrestling this issue for a while now and cannot seem to get the following "touchesEnded" method to execute within a UISCROLLVIEW. I have read on many of the forums that UISCROLLVIEW will take control of all touch events unless it is subclassed, but I cannot seem to get the code right (still new to the SDK). Basically I have a scrollview made uo with several UIIMAGEVIEW's and currenlty have scrolling with paging (much like the photo app). I have been studying the SCROLLING MADDNESS example without success. All I want to do is anywhere in the UISCROLLVIEW have the user double tap to presentModalViewController back to my info page (i.e.)
(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
NSSet *allTouches = [event allTouches];
switch ([allTouches count]) {
case 1: {// One finger touch
UITouch *touch = [[allTouches allObjects] objectAtIndex:0];
if ([touch tapCount] == 2) {InfoButtonViewController *scroll = [[InfoButtonViewController alloc] initWithNibName:nil bundle:nil];
scroll.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:scroll animated:YES];
[scroll release];
}
}
}
}
Any code assistance would be greatly appreciated. The UISCROLLVIEW is implemented as follows (let me know if I need to provide additional details). Thank you in advance...
MyViewController.h
@interface MyViewController : UIViewController
{
}
@end