WebView load css from local file
[[self mainFrame] loadHTMLString:@"<html><body><link href='main.css' rel='stylesheet开发者_运维知识库' type='text/css' /></body></html>" baseURL:nil];
I am trying to load a css file called main.css from the application Resources folder as below from a WebView, how do i get the path of the resources folder correct so i can load the css?
Just take a look at the NSBundle class:
http://developer.apple.com/mac/library/documentation/cocoa/reference/foundation/Classes/NSBundle_Class/Reference/Reference.html
[ [ NSBundle mainBundle ] pathForResource: @"file" ofType: @"css" ]
sorry for the bad formatting... Replied from my iPhone...
精彩评论