UIWebView的HTML文件与SWF加载外部链接,但内部 [英] UIWebView html file with swf load external link, but internal
问题描述
当我尝试在Xcode中添加所有文件,并在本地加载UIWebView时,什么也没有出现,但我知道它试图加载...
- 代码:
NSString * filePath =
[[NSBundle mainBundle] pathForResource:@vimmarofType:@html];
NSData * htmlData = [NSData dataWithContentsOfFile:filePath];
if(htmlData)
{
NSBundle * bundle = [NSBundle mainBundle];
NSString * path = [bundle bundlePath];
NSString * fullPath = [NSBundle pathForResource:@vimmar
ofType:@htmlinDirectory:path];
[pagina_web_local loadRequest:[NSURLRequest requestWithURL:
[NSURL fileURLWithPath:fullPath]]];
{
NSLog(@没有数据给你...);
$ / code>
- 此处为HTML
<!DOCTYPE html>
< html>
< head>
< meta http-equiv =Content-Typecontent =text / html; charset = utf-8/>
< title>默认< / title>
< meta name =apple-mobile-web-app-capablecontent =yes/>
< style type =text / css>
@media只有屏幕和(min-device-width:800px){html {overflow:hidden; }}
* {padding:0;保证金:0; }
html {height:100%; }
body {height:100%;溢出:隐藏; }
#container {height:100%;最小高度:100%;宽度:100%;保证金:0汽车; }
< / style>
< / head>
< body>
< script src =swfobject / swfkrpano.js>< / script>
< div id =container>
< div id =panoDIVstyle =height:100%;>
< script>
embedpano({target:panoDIV,swf:vimmar.swf});
< / script>
< noscript>
< div id =tour>
< object width =100%height =100%>
< embed src =vimmar.swfwidth =100%height =100%allowFullScreen =true>< / embed>
< / object>
< / div>
< / noscript>
< / div>
< / div>
< / body>
< / html>
不知道这是否与苹果不接受SWF的事实有关。但是,如果不是,为什么外面呢?你同意吗?
不缺少添加文件。 JS或其他,因为我在这里找到一个工作人员与加载的麻烦。 JS阅读和有用,但还没有找到SWF。
谢谢。
JavaScript
,并以HTML格式处理嵌入的 SWF
文件。 所以我找了一个在iOS中创建 webservice
的方法来编译并运行 SWF
需要在这里( https://github.com/robbiehanson/CocoaHTTPServer/ )。
SWF文件不纯,它编译并转换成HTML可以接受的格式。事情 XCode
本身不是。
所以,我得到了我们需要的结果。
如果你需要的话,这是解决方案,创建一个迷你web服务来编译JavaScript和其他服务器要处理的内容,并以HTML格式显示最终结果。
When I load an external HTML with SWF embedded, it work in UIWebView.
When I try to add all files in Xcode, and load the UIWebView local, nothing appears, but I know it tried to load ...
-The Code:
NSString *filePath =
[[NSBundle mainBundle] pathForResource:@"vimmar" ofType:@"html"];
NSData *htmlData = [NSData dataWithContentsOfFile:filePath];
if (htmlData)
{
NSBundle *bundle = [NSBundle mainBundle];
NSString *path = [bundle bundlePath];
NSString *fullPath = [NSBundle pathForResource:@"vimmar"
ofType:@"html" inDirectory:path];
[pagina_web_local loadRequest:[NSURLRequest requestWithURL:
[NSURL fileURLWithPath:fullPath]]];
}
else
{
NSLog(@"No data for you...");
}
-And here HTML
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Default</title>
<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<style type="text/css">
@media only screen and (min-device-width: 800px) { html { overflow:hidden; } }
* { padding: 0; margin: 0; }
html { height: 100%; }
body { height: 100%; overflow:hidden; }
#container { height: 100%; min-height: 100%; width: 100%; margin: 0 auto; }
</style>
</head>
<body>
<script src="swfobject/swfkrpano.js"></script>
<div id="container">
<div id="panoDIV" style="height:100%;">
<script>
embedpano({target:"panoDIV",swf:"vimmar.swf"});
</script>
<noscript>
<div id="tour">
<object width="100%" height="100%">
<embed src="vimmar.swf" width="100%" height="100%" allowFullScreen="true"></embed>
</object>
</div>
</noscript>
</div>
</div>
</body>
</html>
Do not know if it has to do with the fact that the apple does not accept SWF. But if not, why are carried outside? Do you agree?
Not for lack of adding the files. JS or other, as I found here a staff with trouble loading. JS was read and useful, but have not found SWF.
Thank you.
I suspect that Apple would not build the JavaScript
and process the embedded SWF
file in HTML.
So I looked for a way to create a webservice
in iOS to compile and run SWF
needed here (https://github.com/robbiehanson/CocoaHTTPServer/).
SWF file is not pure, it compiles and transforms into a format acceptable to HTML. Thing that XCode
does not natively.
So, I got the result we needed.
If you someone need, this is the solution, creating a mini webservice to compile javascripts and other things that a server is to process and display the final result in HTML.
这篇关于UIWebView的HTML文件与SWF加载外部链接,但内部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!