3

我在这里有这个代码userTrackingMode = .follow,它工作得很好,但它只是弹出Userlocation而不是动画地图去用户位置......这就是我想要的。任何人都可以告诉我热添加该动画,使地图通过动画更改到用户位置,而不仅仅是弹出它(如果有意义的话)

import UIKit
import MapKit
import CoreLocation

class MapViewController: UIViewController,MKMapViewDelegate, CLLocationManagerDelegate{

    @IBOutlet weak var mapView: MKMapView!

    @IBAction func UserTrackingMode(sender: AnyObject) {

        mapView.userTrackingMode = .Follow
    }
4

1 回答 1

2

您可以调用setUserTrackingMode:animated以使过渡动画化:

@IBAction func UserTrackingMode(sender: AnyObject) {

    mapView.setUserTrackingMode(.Follow, animated:true)
}
于 2016-09-02T00:11:50.860 回答