public
Created

Custom image for MKAnnotationView in RubyMotion

  • Download Gist
beer_map_controller.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.