我目前正在使用以下代码
在UIWebview
中嵌入PDF
override func viewDidLoad() {
super.viewDidLoad()
let lesson2_2 = "lesson2_2"
if let url = Bundle.main.url(forResource: lesson2_2, withExtension: "pdf") {
let urlRequest = URLRequest(url: url)
webview.loadRequest(urlRequest as URLRequest)
webview.scalesPageToFit = true
webview.isOpaque = false
}
}
PDF显示正常但在左上角的框中显示页码。有什么方法可以删除这个号码并将其隐藏起来吗?
答案 0 :(得分:1)
哟可以尝试下面的代码,将隐藏左上角的页码视图:
for subView: UIView in webView.subviews() {
if (subView is UIScrollView) {
for shadowView: UIView in subView.subviews() {
if (shadowView is UIImageView) {
shadowView.isHidden = true
}
}
}
}