gpt4 book ai didi

ios - UIWebView 以低质量的放大状态呈现网页

转载 作者:搜寻专家 更新时间:2023-11-01 05:41:00 24 4
gpt4 key购买 nike

使用 UIWebView 呈现第三方网站。由于各种原因,我无法使用 WKWebView。

Storyboard中没有与我的 ViewController 关联的 Xib/View。所有 UI 都在 viewDidLoad() 方法中加载

    let navigationBar = UINavigationBar()
navigationBar.setTranslatesAutoresizingMaskIntoConstraints(false)
navigationBar.barStyle = UIBarStyle.Black
//added navigation items
self.view.addSubview(navigationBar)

UXHelper.createHorizontalConstraints(navigationBar, outerView: self.view, margin: 0)
UXHelper.createConstraint(navigationBar, parent: self.view, to: self.view, constraint: NSLayoutAttribute.Top, margin: 0)
UXHelper.createConstraint(navigationBar, parent: self.view, to: nil, constraint: NSLayoutAttribute.Height, margin: AlgoLinkWebViewController.navBarHeight)

self.webView = UIWebView()
self.webView.backgroundColor = UIColor.whiteColor()
self.webView.opaque = false
self.webView.setTranslatesAutoresizingMaskIntoConstraints(false)
self.webView.delegate = self
self.view.addSubview(self.webView)

UXHelper.createHorizontalConstraints(self.webView, outerView: self.view, margin: 0)
UXHelper.createConstraint(self.webView, parent: self.view, to: self.view, constraint: NSLayoutAttribute.Bottom, margin: 0)
self.view.addConstraint(NSLayoutConstraint(item: self.webView, attribute: NSLayoutAttribute.Top, relatedBy: NSLayoutRelation.Equal, toItem: navigationBar, attribute: NSLayoutAttribute.Bottom, multiplier: 1, constant: 0))

下面是上面代码渲染出来的webView的截图

UI WebView with bigger font for Web Content

我正在寻找的预期 WebView 渲染是 .这是来自另一个我知道使用 UIWebView 但无权访问代码的应用程序

UI WebView with the expected Font size

注意:请忽略导航栏的差异

我试过的选项是

  1. 删除 Autoresizing = false
    • 删除它并没有删除放大状态
  2. webView.scalesWebPagesToFit = true
    • 设置这个没有什么不同
  3. 使用父 View 框架大小初始化 UIWebView
    • self.webView = UIWebView(frame: self.view.bounds) - 没有区别
  4. 将 ScrollView 比例值设置为 0.5
    • 没有影响

最佳答案

也许您在 iPhone6/6plus 上使用缩放模式。

关于ios - UIWebView 以低质量的放大状态呈现网页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30471867/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com