I am an iOS newbie. I want to have a function that loads the content from a local html resource file or a webpage depending on what is specified in a constant. How would I go about doing it? For eg, if I pass a file://… to the function or an http://… , it should render accordingly.
Share
You can easily load webpages like this:
For local files it depends on the location of the file on your device:
For files in your main-bundle (= your project), you can use the same loadRequest function, but build the path differently:
and if you want to load a html-string in your webView:
and if your html-file resides in your documents folder of your application (for example a html-file you downloaded):