Art*_*rti 7 macos cocoa nsview
WKWebView在我看来,我有一个
@IBOutlet weak var htmlWKWebView: WKWebView!
我想将背景颜色更改为红色.我试过了:
htmlWKWebView.wantsLayer = true
htmlWKWebView.layer?.masksToBounds = true
htmlWKWebView.layer?.isOpaque = false
htmlWKWebView.layer?.backgroundColor = NSColor.red.cgColor
Run Code Online (Sandbox Code Playgroud)
没有任何效果.只有这个:
htmlWKWebView.setValue(false, forKey: "drawsBackground")使背景透明.但背景颜色没有设置
webView.setValue(false, forKey: "drawsBackground")在 web 视图下面的视图上使用和设置颜色怎么样?使用类似的东西:bgColorView.setValue(myBGColor, forKey: "backgroundColor")
| 归档时间: |
|
| 查看次数: |
585 次 |
| 最近记录: |