0

我正在尝试为 iOS 应用程序实现 360° 旋转。我的目标是在 HTML 上完成并在 UIWebView 中加载它。

我试过的:

我使用JQuery Reel 插件进行 360° 旋转。

我的HTML 代码如下所示:

<script src="JQuery.js" type="text/javascript"></script>
<script src="reel.js" type="text/javascript"></script>

 <img src="images/360_1.jpg" width="480" height="360"
        class="reel"
        data-images="images/360_#.jpg|1..36"
        data-frames="10"
        data-footage="2"
        data-revolution="800">

结果 :

这适用于 Windows(Firefox、Chrome 和 IE)和 Mac OS(Safari)。但在 iOSUIWebView中它只显示初始图像而不是旋转。

iOS 代码:

在 iOS 中,我将整个文件添加到我的项目中并加载如下页面:

NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]];
[self.webview loadRequest:[NSURLRequest requestWithURL:url]];

也试过:

NSString *path = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"];
NSString *html = [[NSString alloc] initWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];  
[self.webviewloadHTMLString:html baseURL:[[NSBundle mainBundle] bundleURL]];

但是没有解决我的问题,请帮助我。

4

1 回答 1

0

最后我通过以下步骤解决了这个问题。

1)通过"Create folder references for any added folders"XCode.

2)我使用以下代码加载 HTML 并且它有效:

// 360 is the folder which contains the HTML files
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"index" ofType:@"html" inDirectory:@"360"]];
[self.webview loadRequest:[NSURLRequest requestWithURL:url]];
于 2014-04-17T09:32:30.493 回答