Add double tap action (presentModalViewController) to UISCOLLVIEW

Posted by R.J. on Stack Overflow See other posts from Stack Overflow or by R.J.
Published on 2010-04-29T05:00:04Z Indexed on 2010/04/29 5:07 UTC
Read the original article Hit count: 396

Filed under:
|
|

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

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uiscrollview