我嘗試在我的web視圖中加載本地HTML頁面。它加載但圖像未加載。在iphone中加載HTML資源
我的結構文件的情況如下:index.html中
圖像路徑
Web視圖<div class = "logo mt10 text-center"> <img src="images/logo.png" alt="Logo Goes Here"> </div>
加載HTML頁面
NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"];
NSString* htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil];
NSString *path = [[NSBundle mainBundle] bundlePath];
NSURL *baseURL = [NSURL fileURLWithPath:path];
[web loadHTMLString:htmlString baseURL:baseURL];
幫助我解決這個
是你的css loading? – manujmv
不,我的CSS也不加載 – user2893370
@ user2893370希望你試過我的解決方案給出如下。 – z22