这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ Sets the center of the map. `animated` property defaults to `true`.

Shows the user's location on the map. Must be called in the view initialization sequence on `will_appear` or _after_.

#### track_user_location({ heading: true })

Causes the map view to center the map on that location and begin tracking the user’s location. `heading` defaults to false but will provide a compass heading if set to true.

#### look_up_location(CLLocation) { |placemark, error| }

This method takes a CLLocation object and will return one to many CLPlacemark to represent nearby data.
Expand Down
9 changes: 9 additions & 0 deletions lib/ProMotion/map/map_screen_module.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ def showing_user_location?
self.view.showsUserLocation
end

def track_user_location params={}
params = {heading: false}.merge(params)
set_track_user_location params[:heading]
end

def set_track_user_location heading
self.view.userTrackingMode = heading ? MKUserTrackingModeFollowWithHeading : MKUserTrackingModeFollow
end

def user_location
user_annotation.nil? ? nil : user_annotation.coordinate
end
Expand Down