Add annotations from Array from core data

236 views Asked by At

I have a map and annotations saved in core data with latitude and longitude and description, i want to get the lat and longit values and add a annotation in Map, but how can i add all the annotations from core data? i only know who add one, not all. This is part of code:

    func displayLocationInfo(placemark:CLPlacemark){
    println("display")
    self.locManager.stopUpdatingLocation()

    lat.text = String(stringInterpolationSegment: placemark.location.coordinate.latitude);
    long.text = String(stringInterpolationSegment: placemark.location.coordinate.longitude);
    latitude = lat.text!
    longitude = long.text!

    var latD:CLLocationDegrees = 0.1
    var longD:CLLocationDegrees = 0.1

    var la:CLLocationDegrees = (latitude as NSString).doubleValue
    var lo:CLLocationDegrees = (longitude as NSString).doubleValue

    var span:MKCoordinateSpan = MKCoordinateSpanMake(latD, longD)

    var locat:CLLocationCoordinate2D = CLLocationCoordinate2DMake(la, lo)
    var reg:MKCoordinateRegion = MKCoordinateRegionMake(locat, span)
    mapRadar.setRegion(reg, animated: true)

    var anotacao = MKPointAnnotation()

    anotacao.coordinate = locat

    anotacao.title = "Nos"

    anotacao.subtitle = "ESTG"

    mapRadar.addAnnotation(anotacao)
}
0

There are 0 answers