使用PanGesture和GoogleVR全景图像

4

我需要在iOS设备上显示360度图片。 我选择使用GoogleVR来完成这个任务(https://developers.google.com/vr/),并且我正在使用GVRPanoramaView (https://developers.google.com/vr/ios/vr-view)。

_panoView = [[GVRPanoramaView alloc] initWithFrame:self.view.bounds];  
[_panoView loadImage:[UIImage imageNamed:@"VRTest.jpg"]];
[self.view addSubview:_panoView];

它的表现很好,图像被显示出来,我能够使用设备的陀螺仪在四周查看。

我想能够使用平移手势在图像上移动,但我没有找到使用给定SDK实现这一点的方法。

这是否可能?我没有在文档中找到任何说不可能的事情...但也没有找到任何解决方案...

1个回答

1
最终我使用了同一框架的Web版本...它处理陀螺仪和平移手势(但仅限于y轴周围)... https://developers.google.com/vr/concepts/vrview-web 我将框架嵌入我的应用程序中以使其本地化(我希望能够加载离线图像) https://github.com/google/vrview 然后我使用了一个简单的Web视图:
UIWebView *webview = [[UIWebView alloc] initWithFrame:self.view.bounds];

// Path depends of your bundle
NSString *indexPath = [[NSBundle mainBundle] pathForResource:@"vrview/index" ofType:@"html"];
NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"VRTest" ofType:@"jpg"];

// load the local framework with the local image 
[webview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@?image=%@&is_stereo=false", indexPath, imagePath]]]];

// Disable scroll because of collision with pan gesture
webview.scrollView.scrollEnabled = NO;

[self.view addSubview:webview];

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接