Create a gist now

Instantly share code, notes, and snippets.

Custom image for MKAnnotationView in RubyMotion
ViewIdentifier = 'ViewIdentifier'
def mapView(mapView, viewForAnnotation:beer)
if view = mapView.dequeueReusableAnnotationViewWithIdentifier(ViewIdentifier)
view.annotation = beer
else
view = MKAnnotationView.alloc.initWithAnnotation(beer, reuseIdentifier:ViewIdentifier)
view.image = UIImage.imageNamed('signpost.png')
view.canShowCallout = true
# view.animatesDrop = true
button = UIButton.buttonWithType(UIButtonTypeDetailDisclosure)
button.addTarget(self, action: :'showDetails:', forControlEvents:UIControlEventTouchUpInside)
view.rightCalloutAccessoryView = button
end
view
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment