开发者

How to disable zoom glass/lens from UIWebView?

I have disable default call out action sheet from UIWebView by using this -

[webView stringByEvaluatingJavaScriptFromString:@"document.body.style.webkitTouchCallout='none';"];

it's working fine but the main problem is that when i tap on an image for a lon开发者_如何学运维g time a zoom lens of UIWebView comes there and i want to disable it, is it possible? then how?


Yes a few ways but some of which are buggy. If you don't care about userinteraction at all you can just disabled it. Then they will only be able to zoom and move around the page (but not click any links or anything).

-(void)removeInput{
    UIScrollView *webViewContentView;
    for (UIView *checkView in [webView subviews] ) {
    if ([checkView isKindOfClass:[UIScrollView class]]) {
        webViewContentView = (UIScrollView*)checkView;
            break;
        }
    }

    for (UIView *checkView in [webViewContentView subviews] ) {
        checkView.userInteractionEnabled = NO;
    }
}

UIWebView without Copy/Paste and selection rectangle when showing documents

However that causes all userInteraction to be disabled which might not be what you want? To JUST disable the magnifying glass I don't think is possible (though I might be wrong?).


Ok if you don't mind disabling the text selection as well you can try this.

ObjC

[webView stringByEvaluatingJavaScriptFromString:@"document.onmousedown = function() {return false;}"];

JavaScript

document.onselectstart = function() {return false;} // ie
document.onmousedown = function() {return false;} 

Source: http://javascript.internet.com/page-details/disable-text-selection.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜