1
我試圖讓2個.js文件和一個.css文件通過一個HTML文件(正在被發現)加載到iOS上的UIWebView應用程序中, ..但它不工作..在xcode6中添加2個.js文件和一個.css文件到UIWebView
這些文件在構建階段等已經複製的複製包資源..
這是到目前爲止的代碼在ViewController.m
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"game1" ofType:@"html" inDirectory:nil];
NSString* htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil];
//Append javascript
NSString *script = @"<script src>TheScript4.js</script>";
htmlString = [htmlString stringByAppendingString:script];
[self.webview loadHTMLString:htmlString baseURL:nil];
}
我m正在運行xcode6 ..
在正確的方向等任何幫助將是巨大的,非常感謝..