3

Upon loading a page in safari, it loads up perfectly fine. Load it up in uiwebview, and the fonts all become enlarged.

I did my research, and all seems to be fine. I've tried..

  • -WebView.scalesPageToFit = true
  • Tried the default constraints on the webview
  • <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1"/>
  • webkit-text-size-adjust:100%/none

Im pretty sure its just a uiwebview issue, since it loads perfectly fine in safari.

This is the uiwebview tutorial I used.. https://www.youtube.com/watch?v=rcVv1N1hReQ

This is the uiwebview code im using..

@IBOutlet var WebView: UIWebView!

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.

    let URL = NSURL(string: "http://website")
    WebView.loadRequest(NSURLRequest(URL: URL!))
    WebView.scalesPageToFit = true
}

I've been kind of bummed out, thanks for all your help.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
royjr
  • 167
  • 1
  • 9
  • 1
    Were you able to find a solution to this? – Tomislav Markovski Feb 23 '16 at 19:22
  • Be sure to check out this QA, which may be relevant http://stackoverflow.com/questions/38203209/font-sizes-in-uiwebview-does-not-match-ios-is-72-96-magic-correction-best-sol/38204413#38204413 – Fattie Jul 05 '16 at 14:03
  • 2
    It's really very strange that these are the only two QA about this on the whole web. It's such an obvious problem. The first time I loaded a UIWebView I said "how come the fonts are too large?". – Fattie Jul 05 '16 at 14:05
  • 1
    Facing same issue. Have you got solution ? If yes, please help me. – iAkshay Nov 09 '16 at 12:02

1 Answers1

0

In case anyone is still looking for a solution, I found that switching to WKWebView (without making any other changes) solved this problem. UIWebView is deprecated now anyway, so this is just another incentive to switch.

Angela
  • 129
  • 1
  • 11