Skip to content

Latest commit

 

History

History
45 lines (35 loc) · 1.36 KB

README.md

File metadata and controls

45 lines (35 loc) · 1.36 KB

本工程主要介绍了 高德地图iOS SDK 3D版本 在基于地图的定位图标旋转

前述

功能描述

自定义定位类,会更随手机定位角度进行旋转

核心类/接口

接口 说明 版本
LocationAnnotationView rotateDegree 继承自MAAnnotationView ----

核心难点

objective-c:

///定位回调
- (void)mapView:(MAMapView *)mapView didUpdateUserLocation:(MAUserLocation *)userLocation updatingLocation:(BOOL)updatingLocation
{
    if (!updatingLocation && _locationAnnotationView != nil)
    {
        [UIView animateWithDuration:0.1 animations:^{
            _locationAnnotationView.rotateDegree = userLocation.heading.trueHeading - _mapView.rotationDegree;
        }];
    }
}

swift:

func mapView(_ mapView: MAMapView!, didUpdate userLocation: MAUserLocation!, updatingLocation: Bool) {
    if !updatingLocation && _locationAnnotationView != nil {
        UIView.animate(withDuration: 0.1, animations: { 
            self._locationAnnotationView.rotateDegree = CGFloat(userLocation.heading.trueHeading) - mapView.rotationDegree
        })
    }
}