UIWebView touch event
Hi,
Im holding some formatted text in a UIWebview, and I need to handle basic swipes so that I can change the contained text. The problem is that the web view captures all the user touches before I can see what they are. I have a view controller which Im adding a UIWebView object to, and Im then adding a custom UIView as a subView of this.
some sample code to help explain:
Where should I be putting the touchesMoved etc functions? I've tried adding them to the custom UIView and to the view controller directly but it still doesnt work
Im holding some formatted text in a UIWebview, and I need to handle basic swipes so that I can change the contained text. The problem is that the web view captures all the user touches before I can see what they are. I have a view controller which Im adding a UIWebView object to, and Im then adding a custom UIView as a subView of this.
some sample code to help explain:
Code:
// in the main view controller
webView = [[UIWebView alloc] initWithFrame:webFrame];
//this is the custom UIView
swipes = [[[Swipes alloc] initWithFrame: CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)] autorelease];
[webView addSubview:swipes];
self.view = webView;
//in the touchesBegan etc functions within Swipes and the main viewController
if(self.superview)
[self.superview touchesBegan:touches withEvent:event];Where should I be putting the touchesMoved etc functions? I've tried adding them to the custom UIView and to the view controller directly but it still doesnt work
Hi,
To me it looks like you should disable touch handling on the WebView and do your touch handling on the UIView which embeds the WebView. You can delegate some events to the WebView. This technique is used in the iphone-google-maps-component. See its sources for example.
Here is your link: http://code.google.com/p/iphone-google-maps-component/
HTH,
Alex
To me it looks like you should disable touch handling on the WebView and do your touch handling on the UIView which embeds the WebView. You can delegate some events to the WebView. This technique is used in the iphone-google-maps-component. See its sources for example.
Here is your link: http://code.google.com/p/iphone-google-maps-component/
HTH,
Alex
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Timer and Touch Event concurrent issue | claudie | 7 | 3,874 |
Aug 9, 2009 06:05 PM Last Post: claudie |
|
| UIWebView in UIScrollView | anto66r | 0 | 3,369 |
Apr 22, 2009 04:54 AM Last Post: anto66r |
|

