是的几种方法,但其中一些是越野车。 如果您根本不关心用户交互,您可以将其禁用。然后他们将只能放大和移动页面(但不能点击任何链接或任何东西)。
-(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
然而这会导致所有用户交互被禁用这可能不是你想要什么? 只是禁用放大镜,我不认为是可能的(虽然我可能是错的?)。
好吧,如果你不介意禁用文本选择,以及你可以试试这个。
ObjC
[webView stringByEvaluatingJavaScriptFromString:@"document.onmousedown = function() {return false;}"];
的JavaScript
document.onselectstart = function() {return false;} // ie
document.onmousedown = function() {return false;}
来源: http://javascript.internet.com/page-details/disable-text-selection.html
感谢您的帮助,但我不希望使用户交互禁用,我就只想隐藏变焦当用户点击网页浏览时镜头。 – saadnib 2011-06-14 04:13:53
@saadnib用另一个可能的答案更新了答案。 – 2011-06-14 14:51:52