I have a common css file and some dynamic html text. What I am trying to do is load the css file from the disk and use dynamic html text to display in the UIWebView instead of putting the same css as text over and over again with the html text.
I am trying this way.
var sometext = "<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\"></head>" + "<body><p>some text goes here</p></body></html>"
let mainbundle = NSBundle.mainBundle().bundlePath
let bundleURL = NSURL(fileURLWithPath: mainbundle)
self.webview.loadHTMLString(sometext, baseURL: bundleURL)
Now the problem is css is not getting applied to the html. Is there any one out there who can help, I think I am stuck.
Please help. Thanks!
self.webView.loadHTMLString(sometext, baseURL: NSBundle.mainBundle().bundleURL)