jpsim / JPSThumbnailAnnotation

A simple mapkit annotation for displaying images and details.
http://jpsim.com/JPSThumbnailAnnotation
MIT License
473 stars 78 forks source link

Adding annotation to an array #21

Open nassarofficial opened 9 years ago

nassarofficial commented 9 years ago
func annotations() -> [JPSThumbnailAnnotation] {
    var annotations: [JPSThumbnailAnnotation] = []
    let pointData = NSData(contentsOfFile: NSBundle.mainBundle().pathForResource("1000", ofType: "geojson")!)
    let points = NSJSONSerialization.JSONObjectWithData(pointData!,
        options: nil,
        error: nil) as! NSDictionary
    for point in points["glimps"] as! NSArray {
        let a = JPSThumbnail()
        a.image = UIImage(named: "empire.jpg")
        a.title = "Empire State Building"
        a.subtitle = "NYC Landmark"
        let lat = (point as! NSDictionary)["latitude"] as! CLLocationDegrees
        let lon = (point as! NSDictionary)["longitude"] as! CLLocationDegrees

        a.coordinate = CLLocationCoordinate2DMake(lat, lon)
        a.disclosureBlock = { println("selected Empire") }
        let a1: JPSThumbnailAnnotation = JPSThumbnailAnnotation()

        annotations.append(a1)
    }
    return annotations
}

This is my code the annotations are appearing on top of each other, with no thumbnail for some reason, how can I fix this in swift?