ios - Load local html into UIWebView using swift -
this 1 driving me crazy morning. want load local html web view:
class privacycontroller: uiviewcontroller { @iboutlet weak var webview:uiwebview! override func viewdidload() { allow url = nsurl(fileurlwithpath: "privacy.html") allow request = nsurlrequest(url: url!) webview.loadrequest(request) } } the html file located in root folder of project within group. webview blank me. ideas whats wrong? on xcode 6.1 , running illustration on iphone 6.
to retrieve urls application resources, should utilize urlforresource method of nsbundle class.
try
let url = nsbundle.mainbundle().urlforresource("privacy", withextension:"html") ios swift uiwebview
No comments:
Post a Comment