最近工程中用到720度全景展示,網上已經有前人給種好樹了,很不錯的封裝。使用起來很是方便...
//相應地方添加成員變量 plView = [[PLView alloc] initWithFrame:self.view.frame]; plView.delegate=self; [self.view addSubview:plView]; [self.view sendSubviewToBack:plView];//送到最里端 [self selectPanorama:1];
-(void)selectPanorama:(NSInteger)index { NSObject<PLIPanorama> *panorama = nil; //Spherical2 panorama example (supports up 2048x1024 texture) if(index == 0) { panorama = [PLSpherical2Panorama panorama]; [(PLSpherical2Panorama *)panorama setImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_sphere2" ofType:@"jpg"]]]; } //Spherical panorama example (supports up 1024x512 texture) else if(index == 1) { panorama = [PLSphericalPanorama panorama]; [(PLSphericalPanorama *)panorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_sphere" ofType:@"jpg"]]]]; } //Cubic panorama example (supports up 1024x1024 texture per face) else if(index == 2) { PLCubicPanorama *cubicPanorama = [PLCubicPanorama panorama]; [cubicPanorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_f" ofType:@"jpg"]]] face:PLCubeFaceOrientationFront]; [cubicPanorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_b" ofType:@"jpg"]]] face:PLCubeFaceOrientationBack]; [cubicPanorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_l" ofType:@"jpg"]]] face:PLCubeFaceOrientationLeft]; [cubicPanorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_r" ofType:@"jpg"]]] face:PLCubeFaceOrientationRight]; [cubicPanorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_u" ofType:@"jpg"]]] face:PLCubeFaceOrientationUp]; [cubicPanorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_d" ofType:@"jpg"]]] face:PLCubeFaceOrientationDown]; panorama = cubicPanorama; } //Cylindrical panorama example (supports up 1024x1024 texture) else if(index == 3) { panorama = [PLCylindricalPanorama panorama]; //((PLCylindricalPanorama *)panorama).isHeightCalculated = NO; [(PLCylindricalPanorama *)panorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_sphere" ofType:@"jpg"]]]]; } }
兩個下載地址:http://code.google.com/p/panoramagl/
https://github.com/menssen/panoramagl#51-with-interface-builder
另有介紹使用的:http://www.codeproject.com/Articles/60635/Panorama-360-iPod-Touch-iPhone