Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding annotation to an array #21

Open
nassarofficial opened this issue May 11, 2015 · 0 comments
Open

Adding annotation to an array #21

nassarofficial opened this issue May 11, 2015 · 0 comments

Comments

@nassarofficial
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant