Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 07-04-2009, 12:21 AM   #1 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 246
Question Detect Tap in WebView

Hi, I'm working on an ebook reader and I'm using an UIWebView to display the different pages in html format. I have a toolbar a the bottom that has buttons to go to the next and previous pages and a navigation bar at the top that displays the title. The problem I have is that I want to be able to hide/show those bars when I tap on the screen, but I don't know how to detect taps on the webview. I tried the method described at the end of this page but it's not working. Can anyone help please?
linkmx is offline   Reply With Quote
Old 07-04-2009, 08:31 PM   #2 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 246
Default

Ok, I have the following code working:

Code:
-(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {		
	NSSet *touches = [event allTouches];
	BOOL forwardToSuper = YES;
	NSLog(@"hit");	
	NSLog(@"Touches count: %d", [touches count]);
	for (UITouch *touch in touches) {		
		if ([touch tapCount] == 1) {						
			forwardToSuper = NO;
		}		
	}
	
	if (forwardToSuper){
		//return self.superview;
		return [super hitTest:point withEvent:event];
	}
	else {
		// Return the superview as the hit and prevent
		// UIWebView receiving double or more taps
		return self.superview;
	}
}
But for some reason, it doesn't detect taps, the touches count is zero. Does anyone knows how to detect taps or how to know if the webview is scrolling?
linkmx is offline   Reply With Quote
Old 09-27-2009, 02:37 PM   #3 (permalink)
Registered Member
 
Join Date: Jul 2009
Posts: 9
Default

I am facing the same problem.... did u get this to work?
anuragphadke is offline   Reply With Quote
Old 09-29-2009, 01:02 AM   #4 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 246
Default

Quote:
Originally Posted by anuragphadke View Post
I am facing the same problem.... did u get this to work?
No
linkmx is offline   Reply With Quote
Old 09-29-2009, 01:12 AM   #5 (permalink)
Registered Member
 
Join Date: Jul 2009
Posts: 14
Default

Have you tried putting a transparent UIView on top of your WebView and handling your touches there? Pass the info along to the webview, etc.
Enoch is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 246
23 members and 223 guests
ADY, Alsahir, beleg_1998, Dani77, diyora, FAED, fredidf, iDifferent, iph_s, JamesCahall, JasonR, mer10, prchn4christ, Rudy, smithdale87, Speed, spiderguy84, stekki, tgjorgoski, timle8n1, Touchmint, twerner, vigu360
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,880
Threads: 89,228
Posts: 380,755
Top Poster: BrianSlick (7,129)
Welcome to our newest member, @sandris
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:11 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0