如何将html文件嵌入webview中的xcode?

如何将html文件嵌入webview中的xcode?,html,xcode,webview,cross-platform,Html,Xcode,Webview,Cross Platform,嘿,伙计们,我最近一直在开发使用html和javascript的移动应用程序,这很好,但现在我想将html文件嵌入到一个xcode项目中,这样我就可以在iphone上运行它,而不必使用phonegape,但运气不好 i tried viewing some video tutorial reading some articles but not one worked with me ... 那么,有人能告诉我(一步一步地)如何做到这一点吗。 另外,我不熟悉xcode,我只使用过几天。您可以使

嘿,伙计们,我最近一直在开发使用html和javascript的移动应用程序,这很好,但现在我想将html文件嵌入到一个xcode项目中,这样我就可以在iphone上运行它,而不必使用phonegape,但运气不好

i tried viewing some video tutorial reading some articles but not one worked with me ... 
那么,有人能告诉我(一步一步地)如何做到这一点吗。
另外,我不熟悉xcode,我只使用过几天。

您可以使用xcode在uiwebview中打开本地html文件。下面是一个示例,它将该文件转换为字符串,然后加载到uiwebview中

NSString *htmlStr = [[NSBundle mainBundle] pathForResource:@"yourfilename" ofType:@"html"];
NSString* htmlString = [NSString stringWithContentsOfFile:htmlStr encoding:NSUTF8StringEncoding error:nil];
[webView loadHTMLString:htmlString baseURL:nil];
希望对你有帮助