在Swift中,如何在以下代码之后设置缩放级别以覆盖多个地址?

时间:2014-07-21 20:00:55

标签: swift mkmapview zooming

我有以下代码在mapView中映射多个地址:

@IBOutlet var mapView: MKMapView

var mapThese: Array<AnyObject> = []

override func viewDidLoad() {
    super.viewDidLoad()

    for var index = 0; index < (mapThese.count); ++index {

    var address : String = mapThese[index] as String

    var geocoder = CLGeocoder()
    geocoder.geocodeAddressString(address, {(placemarks: AnyObject[]!, error: NSError!) -> Void in
        if let placemark = placemarks?[0] as? CLPlacemark {
            self.mapView.addAnnotation(MKPlacemark(placemark: placemark))

        }
        })      
    //Here I would like to set the zoom level
}

我需要一种方法来查找绘制地址的边界,然后缩放到该级别。非常感谢您的帮助。

0 个答案:

没有答案