ios - 用户跟踪模式缺少动画,Swift

标签 ios swift animation mkmapview mkusertrackingmode

我这里有这段代码,包括 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/

相关文章:

iphone - 在 xcode 中创建一个新项目,与我预期的选项不同

ios - Swift - 初始化 UITableViewCell

ios - 核心数据 : Inserting from array of dictionaries into SQLite database happens unsorted - set of Foreign Key therefore not possible

swift - 在 [UInt8] 数组或数据中包含 UTF8 字 rune 字

iOS 动画 >> 如何为单个对象设置动画以移动多个位置

ios - 禁用 NSFetchedResultsController 在批量更新删除时生成的动画

ios - 如何添加到 UINavigationController 推送动画,而不是替换它?

ios - 在类中定义 block 以在其他地方使用

ios - 如果将某种类型传递给 Swift 中的函数,如何返回 nil?

iphone - 在 Dropbox 上上传图片时出错