Using UIWebViews (HTML : Swift : Xcode)

Jared Davidson · 65K views · 2015 · 12:43

Open on YouTube

Software (other)Web developmenttutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it as the tutorial they followed when loading URLs or local HTML into a UIWebView, often while debugging problems with that code.

Recommended by 1 people across 1 different months, 2015 to 2016.

What it is

A 2015 screencast by Jared Davidson showing how to embed a UIWebView in an iOS app using Swift and Xcode, including loading web pages and local HTML. It is a step-by-step coding tutorial that ends with a short Glidecam camera test.

What people said

Recommends Abduhafiz · 2016-07 · Stack Overflow · on “Load local html into UIWebView using swift”

This is worked for me: @IBOutlet weak var mWebView: UIWebView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. mWebView.loadRequest(NSURLRequest(URL: NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("fineName", ofType: "html")!))) } Added App Transport Security Settings with Dictionary type in info.plist file. Also added sub key Allow Arbitrary Loads for App Transport Security Settings with type Boolean and value YES . Here [this video] is tutorial. EDITED For Swift 3 (Xcode 8) mWebView.loadRequest(URLRequest(url: URL(fileURLWithPath: Bundle.main.path(forResource: "test/index", ofType: "html")!)))

Cites user3696866 · 2015-09 · Stack Overflow · on “Swift WebViews not working as expected”

I have done lots of research, yet I am stilling having the same problem. I am trying to load a website onto a web view in swift, although every time I run the project, it is giving me the following error message: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP,subcode=0x0) The following two lines of code are what I am attempting to use to load the url onto the web view. I want to let you know that these 2 lines of code came from the following video: [this video] . Here are the lines of code: var URL = NSURL(string: " [LINK] ") petInfo.loadRequest(NSURLRequest(URL: URL!)) In case you are wondering what the outlet for petInfo looks like, it is displayed in the following block of code: @IBOutlet weak var p

Cites royjr · 2015-12 · Stack Overflow · on “Safari vs UIWebView font size difference”

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.. [this video] 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 ni

Cites arbi.tularov · 2016-05 · Stack Overflow · on “Embedded YouTube video in a UIWebView fails to play”

I wanted to implement a UITableView with custom Cell which uses a UIWebView , but my problem is that UIWebView does not show video. I tried to repeat after a lesson [this video] , but it is impossible.