我有一个像“<form>...</form>”这样的表单字符串,我想用 Safari 使用 Objective C 代码打开它,有什么办法可以做到这一点?
您可以简单地将此字符串插入到 HTML 正文标记下并创建一个 .html 文件。
读取 HTML 文件并在 Web 视图中加载:
NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@“sample” ofType:@“html” inDirectory:nil];
NSString* htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil];
[webView loadHTMLString:htmlString baseURL: [[NSBundle mainBundle] bundleURL]];
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句