首页 > 代码库 > UIWebView相关设置
UIWebView相关设置
让UIWebView的背景透明:
1 2 | self .webView.backgroundColor = [ UIColor clearColor ]; self .webView.opaque = NO |
这样就可以背景透明了,如果还是无效的话,那么需要在html里面加入:
<body style="background-color: transparent">
去掉uiwebview滚动到边缘时的阴影效果:(不要重复对一个uiwebview调用这个方法,会导致滚动条消失)
1 2 3 4 5 6 7 8 9 10 11 12 | - ( void ) hideGradientBackground :( UIView *)theView { for ( UIView * subview in theView.subviews) { if ([subview isKindOfClass :[ UIImageView class ]]) subview.hidden = YES ; [ self hideGradientBackground :subview]; } } - ( void )viewDidLoad { [ self hideGradientBackground : self .webView]; } |
去除copy/paste的响应:
1 | [webView stringByEvaluatingJavaScriptFromString : @ "var css = document.createElement(\"style\");css.type = \"text/css\";css.innerHTML = \"* {-webkit-touch-callout: none;-webkit-user-select: none;}\";document.body.appendChild(css);" ];
|
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。