讓UIWebView的背景透明:css
1
2
|
self
.webView.backgroundColor = [
UIColor
clearColor
];
self
.webView.opaque =
NO
|
這樣就能夠背景透明瞭,若是仍是無效的話,那麼須要在html裏面加入:html
<body style="background-color: transparent">web
去掉uiwebview滾動到邊緣時的陰影效果:(不要重複對一個uiwebview調用這個方法,會致使滾動條消失)app
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的響應:ide
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);"
];
|