I have UIWebView for displaying articles. These are all HTML pages. I need to select text from articles. So, i'm using UIMenucontroller for select option. I need to select text while user tap on singleTap. But when use singleTap nothing happen.
-(void)ViewDidLoad{
UITapGestureRecognizer *singletapp=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(singleTap:)];
singletapp.numberOfTapsRequired=1;
[wbCont addGestureRecognizer:singletapp];
}
SingleTap:
-(void)singleTap:(UIGestureRecognizer *)gestureRecognizer
{
NSLog(@"single tap");
CGPoint touchPoint = [gestureRecognizer locationInView:self.view];
NSString *js = [NSString stringWithFormat:@"document.elementFromPoint(%f, %f).toString()", touchPoint.x, touchPoint.y];
NSString * tagName = [wbCont stringByEvaluatingJavaScriptFromString:js];
NSLog(@"Selected Name: %@",tagName);
}