Navigation view system with webview problem with touches!

Posted by Gonçalo Falcão on Stack Overflow See other posts from Stack Overflow or by Gonçalo Falcão
Published on 2009-11-25T14:59:22Z Indexed on 2010/03/26 18:03 UTC
Read the original article Hit count: 399

Filed under:
|

Hello i have search everything and i didn't figure this out!

I have a tab bar controller with 5 navigation controlls, in one of the navigation control, i have a view, with a table view inside, and when i click that item i push a new view, that view have

  view
     -webview
     -view

i create that second view(is transperant) because i need to handle a single tap to hide my toolbar and navigation bar, and the webview was eating all the touches! I put that view and implement on the view controller

-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
 UITouch* touch = [touches anyObject];
 if(touch.tapCount == 2){
  [NSObject cancelPreviousPerformRequestsWithTarget:self];
 } 
 [[wv.subviews objectAtIndex:0] touchesBegan:touches withEvent:event];
 [super touchesBegan:touches withEvent:event];
}

-(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
 [[wv.subviews objectAtIndex:0] touchesMoved:touches withEvent:event];
 [super touchesMoved:touches withEvent:event];
}

-(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
 UITouch* touch = [touches anyObject];
 if(touch.tapCount == 1){
  [self performSelector:@selector(hideBars) withObject:nil afterDelay:0.3];
 }
 [[wv.subviews objectAtIndex:0] touchesEnded:touches withEvent:event];
 [super touchesEnded:touches withEvent:event];
}

-(void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event{
 [[wv.subviews objectAtIndex:0] touchesCancelled:touches withEvent:event];
 [super touchesCancelled:touches withEvent:event];
}

wv is my UIWebView IBOutlet now i can get the the touches in my controller and send them to my webview. So i thought everything was working, i'm able to scroll, but now when i have links i'm not able to click them. And the webview is detecting the links i have made that test. So any other way to implements this to get the touches in the links, or i should change this workaround to hide the toolbars so i can have the full functionability of the webview? Thks for the help in advance.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about webview