Class: MapKit::MapView
- Inherits:
-
MKMapView
- Object
- MKMapView
- MapKit::MapView
- Includes:
- CoreLocation::DataTypes, DataTypes, OverriddenMethods, ZoomLevel
- Defined in:
- lib/map-kit-wrapper/map_view.rb
Overview
Wrapper for MKMapView
Defined Under Namespace
Modules: OverriddenMethods
Constant Summary
Constants included from ZoomLevel
ZoomLevel::MERCATOR_OFFSET, ZoomLevel::MERCATOR_RADIUS
Instance Method Summary collapse
-
#initialize ⇒ MapView
constructor
Initializer for MapView.
-
#region=(args) ⇒ Object
Set the maps region.
-
#scroll_enabled=(enabled) ⇒ Object
Set scroll on/off.
-
#scroll_enabled? ⇒ Boolean
Is scroll enbabled?.
-
#set_region ⇒ Object
Deprecated.
-
#shows_user_location=(enabled) ⇒ Object
Set visible user location on/off.
-
#shows_user_location? ⇒ Boolean
Is the users location shown on the map.
-
#user_coordinates ⇒ Object
Show the users coordinates.
-
#user_located? ⇒ Boolean
Has the user been located yet?.
-
#zoom_enabled=(enabled) ⇒ Object
Set zoom on/off.
-
#zoom_enabled? ⇒ Boolean
Is zoom enabled.
Methods included from OverriddenMethods
Methods included from ZoomLevel
included, #set_center_coordinates, #set_map_lat_lon, #set_zoom_level, #zoom_level
Constructor Details
#initialize ⇒ MapView
Initializer for MapView
19 20 21 |
# File 'lib/map-kit-wrapper/map_view.rb', line 19 def initialize self.alloc.init end |
Instance Method Details
#region=(args) ⇒ Object
Set the maps region
-
Args :
region = CoordinateRegion.new([56, 10.6], [3.1, 3.1]) region = {:region => CoordinateRegion.new([56, 10.6], [3.1, 3.1]), :animated => false}
110 111 112 113 114 115 116 117 |
# File 'lib/map-kit-wrapper/map_view.rb', line 110 def region=(args) case args when Hash self.setRegion(CoordinateRegion.new(args[:region]).api, animated: args[:animated]) else self.setRegion(CoordinateRegion.new(args).api, animated: false) end end |
#scroll_enabled=(enabled) ⇒ Object
Set scroll on/off
-
Args :
-
enabled
-> Bool
-
59 60 61 |
# File 'lib/map-kit-wrapper/map_view.rb', line 59 def scroll_enabled=(enabled) self.setScrollEnabled(enabled) end |
#scroll_enabled? ⇒ Boolean
Is scroll enbabled?
-
Returns :
-
Bool
-
49 50 51 |
# File 'lib/map-kit-wrapper/map_view.rb', line 49 def scroll_enabled? self.isScrollEnabled end |
#set_region ⇒ Object
Deprecated
122 123 124 |
# File 'lib/map-kit-wrapper/map_view.rb', line 122 def set_region raise 'set_region has been deprecated. Please review the docs on region=()' end |
#shows_user_location=(enabled) ⇒ Object
Set visible user location on/off
-
Args :
-
enabled
-> Bool
-
79 80 81 |
# File 'lib/map-kit-wrapper/map_view.rb', line 79 def shows_user_location=(enabled) self.showsUserLocation = enabled end |
#shows_user_location? ⇒ Boolean
Is the users location shown on the map
-
Returns :
-
Bool
-
69 70 71 |
# File 'lib/map-kit-wrapper/map_view.rb', line 69 def shows_user_location? self.showsUserLocation end |
#user_coordinates ⇒ Object
Show the users coordinates. Defaults to nil if the functionality is turned off or the location has not yet been found
-
Returns :
-
LocationCoordinate
-
99 100 101 |
# File 'lib/map-kit-wrapper/map_view.rb', line 99 def user_coordinates self.user_located? ? LocationCoordinate.new(self.userLocation.location.coordinate) : nil end |
#user_located? ⇒ Boolean
Has the user been located yet?
-
Returns :
-
Bool
-
89 90 91 |
# File 'lib/map-kit-wrapper/map_view.rb', line 89 def user_located? self.shows_user_location? && self.userLocation.location ? true : false end |
#zoom_enabled=(enabled) ⇒ Object
Set zoom on/off
-
Args :
-
enabled
-> Bool
-
39 40 41 |
# File 'lib/map-kit-wrapper/map_view.rb', line 39 def zoom_enabled=(enabled) self.setZoomEnabled(enabled) end |
#zoom_enabled? ⇒ Boolean
Is zoom enabled
-
Returns :
-
Bool
-
29 30 31 |
# File 'lib/map-kit-wrapper/map_view.rb', line 29 def zoom_enabled? self.isZoomEnabled end |