我这里有这段代码,包括 userTrackingMode = .follow
并且效果很好,但它只是弹出到 Userlocation
而不是动画 map 以转到用户位置.. .这就是我想要的。任何人都可以告诉我热添加那个动画,使 map 通过动画改变到用户位置,而不仅仅是弹出到它(如果它有意义的话)
import UIKit
import MapKit
import CoreLocation
class MapViewController: UIViewController,MKMapViewDelegate, CLLocationManagerDelegate{
@IBOutlet weak var mapView: MKMapView!
@IBAction func UserTrackingMode(sender: AnyObject) {
mapView.userTrackingMode = .Follow
}
最佳答案
您可以调用 setUserTrackingMode:animated
以动画转换:
@IBAction func UserTrackingMode(sender: AnyObject) {
mapView.setUserTrackingMode(.Follow, animated:true)
}
关于ios - 用户跟踪模式缺少动画,Swift,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39282544/