Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

dantastic

macrumors 6502a
Original poster
Jan 21, 2011
572
678
I have a UITableViewCell with a small UIWebView that displays a youtube link. this is all got from - http://apiblog.youtube.com/2009/02/youtube-apis-iphone-cool-mobile-apps.html It works fine but only if you tap inside the UIWebView itself. I want the user to be able to tap anywhere in the tableview cell and grab that tap and pass it to the uiwebview so that tap starts the youtube video.

So I've created (in the screenshot, everything to the left of the webview) a button. Connected it to the follwing function:
Code:
- (IBAction)ytButtonPressed:(id)sender event:(id) event{
	NSSet *touches = [event allTouches];
	UITouch *touch = [touches anyObject];
	CGPoint currentTouchPosition = [touch locationInView:tableView];
	NSIndexPath *indexPath = [tableView indexPathForRowAtPoint: currentTouchPosition];
	if (indexPath != nil) {
		NSLog(@"getting the click in cell R:%i S:%i", indexPath.row, indexPath.section);
		UITableViewCell *cell = (UITableViewCell *)[(UITableView *)tableView cellForRowAtIndexPath:indexPath];
		LinkableWebView *wv = (LinkableWebView *)[cell viewWithTag:4];
		//Send to the webview itself?	
		[wv touchesEnded:touches withEvent:event];
		//send to the scrollView?
		[[[wv subviews] objectAtIndex:0] touchesEnded:touches withEvent:event];	
		
	}

}


I have tried to subclass uiwebview (for testing only) and I know I am getting the touchesEnded. But the video isn't starting and I'm not sure at this point what else I can try or what component I need to send the touchesEnded to.

Or do anyone know how I can just send a touch to a uiwebview?
 

Attachments

  • ytcell.png
    ytcell.png
    19.5 KB · Views: 793
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.