Skip to content

Instantly share code, notes, and snippets.

@wndxlori
Created July 4, 2012 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wndxlori/3049611 to your computer and use it in GitHub Desktop.
Save wndxlori/3049611 to your computer and use it in GitHub Desktop.
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