2017-04-13 1 views
0

iOS 용 Google지도 SDK를 사용하여 애플리케이션에서 느린 비행을하려고합니다.iOS 용 Google지도의 플라이 오버

내 현재 설정은 다음과 같습니다

-(void)viewDidLoad 
{ 

[super viewDidLoad]; 

locationManager = [[CLLocationManager alloc]init]; 

locationManager.delegate = self; 


locationManager.distanceFilter = kCLDistanceFilterNone; 


locationManager.desiredAccuracy = kCLLocationAccuracyBest; 


[locationManager startUpdatingLocation]; 
[locationManager startUpdatingHeading]; 


CLLocation *location = [locationManager location]; 
CLHeading *heading = [locationManager heading]; 

CLLocationCoordinate2D coordinate = [location coordinate]; 
CLLocationDirection direction = [heading trueHeading]; 

//double latitude = coordinate.latitude; 
//double longitude = coordinate.longitude; 
//double deviceHeading = (direction*M_PI/180); 
//NSLog (@"my longitude :%f",deviceHeading); 

GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:40.7080 longitude:-74.0103 zoom:17 bearing:50 viewingAngle:90]; 
myMapView.myLocationEnabled = YES; 
myMapView.settings.scrollGestures = NO; 
myMapView.settings.zoomGestures = NO; 
myMapView.settings.tiltGestures = NO; 

NSBundle *mainBundle = [NSBundle mainBundle]; 
NSURL *styleUrl = [mainBundle URLForResource:@"GoogleMapsStyle" withExtension:@"json"]; 
NSError *error; 

[myMapView animateToCameraPosition:camera]; 


// Set the map style by passing the URL for style.json. 
GMSMapStyle *style = [GMSMapStyle styleWithContentsOfFileURL:styleUrl error:&error]; 

if (!style) { 
    NSLog(@"The style definition could not be loaded: %@", error); 
} 

myMapView.mapStyle = style; 

[CATransaction begin]; 
[CATransaction setValue:[NSNumber numberWithFloat: 30] forKey:kCATransactionAnimationDuration]; 
GMSCameraPosition *camera2 = [GMSCameraPosition cameraWithLatitude: 40.9234 longitude: -74.3456 zoom: 17]; 
[myMapView animateToCameraPosition: camera2]; 
[CATransaction commit]; 

} 

내가 여기 CATransaction 발견

내보기를로드 그러나 Controlling Animation Duration in Google Maps for iOS

, 맵이 기간 동안 비어를 CATransaction을 클릭하면지도가 camera2 위치에로드됩니다. 이 문제를 해결하거나 더 나은 해결 방법이 있습니까?

감사

답변

0

을 감안할 때 코드가 거의 올바르지 만 한 줄의 필요성을 제거 할 수 :

[myMapView animateToCameraPosition :과 : 카메라 2] CATransaction 완전한 맵이 카메라 위치 설정이 때문에 라인

때문에 코드 행 :

[myMapView animateToCameraPosition :과 : 카메라];

그러나 지도 카메라가 카메라 2로 설정하면 다음 GMSCamera카메라 2로 설정됩니다.

관련 문제