【发布时间】:2014-10-10 19:42:09
【问题描述】:
我正在尝试通过 HTML 文件(正在找到)获取 2 个 .js 文件和一个 .css 文件以加载到 iOS 上的 UIWebView 应用程序中。但它不起作用..
这些文件已经复制到 Build Phases 等下的 Copy Bundle Resources 上。
这是目前在 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];
}
我正在运行 xcode6..
任何在正确方向等方面的帮助都会很棒,非常感谢..
【问题讨论】:
标签: javascript ios css objective-c uiwebview