JPSThumbnailAnnotation
JPSThumbnailAnnotation copied to clipboard
Adding annotation to an array
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?