ProMotion-map 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4fa9190c3b59430b670b821061b1e100bca8a170
4
- data.tar.gz: 68afd534d7381b9814866693a00dbd09f39ad65a
3
+ metadata.gz: 474e4ff59bf9c8ec5c1e1af85378e4f599a05790
4
+ data.tar.gz: ff060d46437d3ba9d1846a6ff3c88c5fb74882ae
5
5
  SHA512:
6
- metadata.gz: 1378133321b46f3bdf9d36aad3c4a07dcc89195a56db40e412a30d9a6f0583c17f3e7dbc4a629821df4265bcb28d99b7272c575f6aed3a4cf5988c44f0b76f65
7
- data.tar.gz: 25a582239c97133ac7027dbe71f52f1bb05b50c440c615f667708f706dd090bcbe4fbfacda512a8492162db66e4a2f61ee77dd96387bd99d280084b446a46147
6
+ metadata.gz: 3e727bb0149a8b9c28913fa23eac3ea3e7169837b45e89d5187db578edf3db3dbca9729b455dc1b4f90352d728fc987ff08631f4c84dcaba2165cd69156403e9
7
+ data.tar.gz: 2ff4660c0a1f2b6aa9d9db44e31e98fcc087d4910c7386737e9c7b36a9ca7fb0c96120a5ffab3aa76d0253909d0b7b4fc5feccfd43f8ea894a385b1cea543279
data/README.md CHANGED
@@ -29,13 +29,15 @@ class MyMapScreen < PM::MapScreen
29
29
  latitude: 35.090648651123,
30
30
  title: "Rainbow Falls",
31
31
  subtitle: "Nantahala National Forest",
32
- action: :show_forest
32
+ action: :show_forest,
33
+ pin_color: :green
33
34
  },{
34
35
  longitude: -82.966093558105,
35
36
  latitude: 35.092520895652,
36
37
  title: "Turtleback Falls",
37
38
  subtitle: "Nantahala National Forest",
38
- action: :show_forest
39
+ action: :show_forest,
40
+ pin_color: MKPinAnnotationColorPurple
39
41
  },{
40
42
  longitude: -82.95916,
41
43
  latitude: 35.07496,
@@ -101,6 +103,7 @@ All possible properties:
101
103
  title: "Stairway Falls", # REQUIRED
102
104
  subtitle: "Gorges State Park",
103
105
  image: "my_custom_image",
106
+ pin_color: :red, # Defaults to :red. Other options are :green or :purple or any MKPinAnnotationColor
104
107
  left_accessory: my_button,
105
108
  right_accessory: my_other_button,
106
109
  action: :my_action, # Overrides :right_accessory
@@ -307,6 +310,28 @@ end
307
310
 
308
311
  ---
309
312
 
313
+ ### Delegate callbacks
314
+
315
+ These methods (if implemented in your `MapScreen`) will be called when the corresponding `MKMapViewDelegate` method is invoked:
316
+
317
+ ```ruby
318
+ def will_change_region(animated)
319
+ # Do something when the region will change
320
+ # The animated parameter is optional so you can also define it is simply:
321
+ # def will_change_region
322
+ # end
323
+ end
324
+
325
+ def on_change_region(animated)
326
+ # Do something when the region changed
327
+ # The animated parameter is optional so you can also define it is simply:
328
+ # def on_change_region
329
+ # end
330
+ end
331
+ ```
332
+
333
+ ---
334
+
310
335
  ### CocoaTouch Property Convenience Methods
311
336
 
312
337
  `MKMapView` contains multiple property setters and getters that can be accessed in a more ruby-like syntax:
@@ -22,7 +22,7 @@ module ProMotion
22
22
  def set_defaults
23
23
  @params = {
24
24
  title: "Title",
25
- pin_color: MKPinAnnotationColorRed,
25
+ pin_color: :red,
26
26
  identifier: "Annotation-#{@params[:pin_color]}-#{@params[:image]}",
27
27
  show_callout: true,
28
28
  animates_drop: false
@@ -1,6 +1,12 @@
1
1
  module ProMotion
2
2
  module MapScreenModule
3
3
 
4
+ PIN_COLORS = {
5
+ red: MKPinAnnotationColorRed,
6
+ green: MKPinAnnotationColorGreen,
7
+ purple: MKPinAnnotationColorPurple
8
+ }
9
+
4
10
  def screen_setup
5
11
  self.view = nil
6
12
  self.view = MKMapView.alloc.initWithFrame(self.view.bounds)
@@ -139,7 +145,7 @@ module ProMotion
139
145
  end
140
146
  view.image = params[:image] if view.respond_to?("image=") && params[:image]
141
147
  view.animatesDrop = params[:animates_drop] if view.respond_to?("animatesDrop=")
142
- view.pinColor = params[:pin_color] if view.respond_to?("pinColor=")
148
+ view.pinColor = (PIN_COLORS[params[:pin_color]] || params[:pin_color]) if view.respond_to?("pinColor=")
143
149
  view.canShowCallout = params[:show_callout] if view.respond_to?("canShowCallout=")
144
150
 
145
151
  if params[:left_accessory]
@@ -306,6 +312,22 @@ module ProMotion
306
312
  end
307
313
  end
308
314
 
315
+ def mapView(map_view, regionWillChangeAnimated:animated)
316
+ if self.respond_to?("will_change_region:")
317
+ will_change_region(animated)
318
+ elsif self.respond_to?(:will_change_region)
319
+ will_change_region
320
+ end
321
+ end
322
+
323
+ def mapView(map_view, regionDidChangeAnimated:animated)
324
+ if self.respond_to?("on_change_region:")
325
+ on_change_region(animated)
326
+ elsif self.respond_to?(:on_change_region)
327
+ on_change_region
328
+ end
329
+ end
330
+
309
331
  ########## Cocoa touch Ruby counterparts #################
310
332
 
311
333
  def type
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ProMotion-map
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Rickert
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-03-09 00:00:00.000000000 Z
12
+ date: 2015-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ProMotion
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  version: '0'
101
101
  requirements: []
102
102
  rubyforge_project:
103
- rubygems_version: 2.2.0
103
+ rubygems_version: 2.4.6
104
104
  signing_key:
105
105
  specification_version: 4
106
106
  summary: Adds PM::MapScreen support to ProMotion. Extracted from ProMotion.