在Google Maps for iOS中更改基于rotateGestures的方位

时间:2016-11-11 09:41:22

标签: ios objective-c google-maps-sdk-ios

我正在使用带有Xcode 8的Google Maps SDK for iOS(版本2.1.1)。我添加了UIView并将其类设置为GMSMapView并与{{1}相关联调用IBOutlet

mapView

View Controller使用2位代表:double bearing; int zoomLevel; - (void)viewDidLoad { [super viewDidLoad]; bearing = 30; zoomLevel = 20; _locationManager = [[CLLocationManager alloc] init]; _locationManager.distanceFilter = kCLDistanceFilterNone; _locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters; _locationManager.delegate = self; [_locationManager startUpdatingLocation]; if([CLLocationManager headingAvailable]) { _locationManager.headingFilter = 5; [_locationManager startUpdatingHeading]; } mapView.myLocationEnabled = YES; mapView.settings.tiltGestures = NO; mapView.settings.scrollGestures = NO; // obtain my position CLLocation *myLocation = mapView.myLocation; GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:myLocation.coordinate.latitude longitude:myLocation.coordinate.longitude zoom:zoomLevel bearing:bearing viewingAngle:45]; mapView.camera = camera; } CLLocationManagerDelegate

更新地图位置不是问题,但是当我旋转地图时,由于轴承值根本没有改变,一旦更新了位置,轴承就会重置并取消旋转。旋转地图后如何更新方位?

以下是GMSMapViewDelegate委托功能:

didUpdateLocations:

我的想法是旋转地图,就像手机游戏PokemonGO一样。

0 个答案:

没有答案