我有以下代码在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
}
我需要一种方法来查找绘制地址的边界,然后缩放到该级别。非常感谢您的帮助。