错误缩小MKMapView

时间:2015-12-07 01:53:47

标签: swift mkmapview

这样可以正常工作,但是当我不断按下缩小按钮时,它会在某种程度上给我异常。我该如何预防?

//MARK: MKMapView
extension MKMapView {

    // delta is the zoom factor
    // 2 will zoom out x2
    // .5 will zoom in by x2

    func setZoomByDelta(delta: Double, animated: Bool) {
        var _region = region
        var _span = region.span
        _span.latitudeDelta *= delta
        _span.longitudeDelta *= delta
        _region.span = _span

        setRegion(_region, animated: animated)
    }
}

0 个答案:

没有答案