2
在我的應用程序中,一個網站包含在一個文件夾中。我試圖加載它在webview中使用以下代碼:CSS和JS文件未加載uiwebview
self.wView.dataDetectorTypes = UIDataDetectorTypeLink;
NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html" inDirectory:NO];
NSLog(@"%@",htmlFile);
//NSData *pathData = [NSData dataWithContentsOfFile:htmlFile];
//NSString *htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil];
NSURL *url = [NSURL URLWithString:[htmlFile lastPathComponent] relativeToURL:[NSURL fileURLWithPath:[htmlFile stringByDeletingLastPathComponent] isDirectory:YES]];
//(void)[NSURLConnection connectionWithRequest:req delegate:self];
[self.wView loadRequest:[NSURLRequest requestWithURL:url]] ;
我在nslog中獲取文件路徑。 但在我的webview中,css和js文件沒有加載。
請幫幫我。