iOS版谷歌地图中的天桥

iOS版谷歌地图中的天桥,ios,objective-c,google-maps,Ios,Objective C,Google Maps,我正在尝试使用google maps SDK for iOS在我的应用程序中进行一次慢速飞越 我当前的设置如下所示: -(void)viewDidLoad { [super viewDidLoad]; locationManager = [[CLLocationManager alloc]init]; locationManager.delegate = self; locationManager.distanceFilter = kCLDistanceFilterNone; lo

我正在尝试使用google maps SDK for iOS在我的应用程序中进行一次慢速飞越

我当前的设置如下所示:

-(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];

}
我在这里找到了交易记录:

但是,当我加载视图时,贴图在CATTransaction期间为空,然后在camera2位置加载贴图。有没有办法解决这个问题或更好的解决方法


谢谢

给定的代码几乎正确,但需要删除一行:

[myMapView animateToCameraPosition:camera2]

由于这一行,当CATTransaction首先完成贴图设置到相机位置时由于这一行代码:

[myMapView animateToCameraPosition:camera]

但是当地图摄影机设置为camera2时,GMSCamera将设置为camera2