README.md in ProMotion-map-0.1.0 vs README.md in ProMotion-map-0.2.0

- old
+ new

@@ -1,8 +1,10 @@ # ProMotion-map -ProMotion-map is push notification support, extracted from the +[![Gem Version](https://badge.fury.io/rb/ProMotion-map.svg)](http://badge.fury.io/rb/ProMotion-map) [![Build Status](https://travis-ci.org/clearsightstudio/ProMotion-map.svg)](https://travis-ci.org/clearsightstudio/ProMotion-map) [![Code Climate](https://codeclimate.com/github/clearsightstudio/ProMotion-map.png)](https://codeclimate.com/github/clearsightstudio/ProMotion-map) + +ProMotion-map provides a PM::MapScreen, extracted from the popular RubyMotion gem [ProMotion](https://github.com/clearsightstudio/ProMotion). ## Installation ```ruby @@ -17,15 +19,15 @@ ```ruby class MyMapScreen < PM::MapScreen title "My Map" start_position latitude: 35.090648651123, longitude: -82.965972900391, radius: 4 - + def on_appear update_annotation_data end - + def annotation_data [{ longitude: -82.965972900391, latitude: 35.090648651123, title: "Rainbow Falls", @@ -57,11 +59,11 @@ subtitle: "Nantahala National Forest", image: UIImage.imageNamed("custom-pin") }] end - + end ``` Here's a neat way to zoom into a specific marker in an animated fashion and then select the marker: @@ -75,11 +77,11 @@ --- ### Methods #### annotation_data - + Method that is called to get the map's annotation data and build the map. If you do not want any annotations, simply return an empty array. ```ruby def annotation_data [{ @@ -115,14 +117,30 @@ your_param: "CustomWahtever" }] end ``` +All possible properties: + +```ruby +{ + longitude: -82.956244328014, + latitude: 35.085548421623, + title: "Stairway Falls", + subtitle: "Gorges State Park", + image: "my_custom_image", + left_accessory: my_button, + right_accessory: my_other_button +} +``` + You may pass whatever properties you want in the annotation hash, but `:longitude`, `:latitude`, and `:title` are required. Use `:image` to specify a custom image. Pass in a string to conserve memory and it will be converted using `UIImage.imageNamed(your_string)`. If you pass in a `UIImage`, we'll use that, but keep in mind that there will be another unnecessary copy of the UIImage in memory. +Use `:left_accessory` and `:right_accessory` to specify a custom accessory, like a button. + You can access annotation data you've arbitrarily stored in the hash by calling `annotation_instance.annotation_params[:your_param]`. #### update_annotation_data Forces a reload of all the annotations @@ -180,11 +198,11 @@ Helper method to create an `MKCoordinateRegion`. Expects a hash in the form of: ```ruby my_region = region({ coordinate:{ - latitude: 35.0906, + latitude: 35.0906, longitude: -82.965 }, # span is the latitude and longitude delta span: [0.5, 0.5] }) @@ -193,10 +211,10 @@ --- ### Class Methods #### start_position(latitude: Float, longitude: Float, radius: Float) - + Class method to set the initial starting position of the `MapScreen`. ```ruby class MyMapScreen < PM::MapScreen start_position latitude: 36.10, longitude: -80.26, radius: 4