开发者

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...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜