Skip to content

Commit

Permalink
Fix custom image for annotation (#1256)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobby Sudekum committed Mar 23, 2018
1 parent bb1f22b commit 9ba5f68
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* Fixed an issue causing the overview map to insist on centering the route upon each location update. ([#1223](https://github.com/mapbox/mapbox-navigation-ios/pull/1223))
* Improved the contrast of `TimeRemainingLabel.trafficSevereColor` against `BottomBannerView.backgroundColor` in `NightStyle`. ([#1228](https://github.com/mapbox/mapbox-navigation-ios/pull/1228))
* Fixed an issue where a slash appeared between two shields in the top banner. ([#1169](https://github.com/mapbox/mapbox-navigation-ios/pull/1169))
* Fixed an issue where using `NavigationMapViewControllerDelegate.navigationMapView(_:imageFor:)` would not override the destination annotation. [#1256](https://github.com/mapbox/mapbox-navigation-ios/pull/1256)

### Spoken instructions
* Audio data for spoken instructions is cached in device storage to minimize data usage. ([#12296](https://github.com/mapbox/mapbox-navigation-ios/pull/1226))
Expand Down
18 changes: 18 additions & 0 deletions MapboxNavigation/NavigationMapView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1209,6 +1209,24 @@ public protocol NavigationMapViewDelegate: class {
@objc(navigationMapView:shapeDescribingWaypoints:)
optional func navigationMapView(_ mapView: NavigationMapView, shapeFor waypoints: [Waypoint]) -> MGLShape?

/**
Asks the receiver to return an MGLAnnotationImage that describes the image used an annotation.
- parameter mapView: The MGLMapView.
- parameter annotation: The annotation to be styled.
- returns: Optionally, a `MGLAnnotationImage` that defines the image used for the annotation.
*/
@objc(navigationMapView:imageForAnnotation:)
optional func navigationMapView(_ mapView: MGLMapView, imageFor annotation: MGLAnnotation) -> MGLAnnotationImage?

/**
Asks the receiver to return an MGLAnnotationView that describes the image used an annotation.
- parameter mapView: The MGLMapView.
- parameter annotation: The annotation to be styled.
- returns: Optionally, a `MGLAnnotationView` that defines the view used for the annotation.
*/
@objc(navigationMapView:viewForAnnotation:)
optional func navigationMapView(_ mapView: MGLMapView, viewFor annotation: MGLAnnotation) -> MGLAnnotationView?

/**
Asks the receiver to return a CGPoint to serve as the anchor for the user icon.
- important: The return value should be returned in the normal UIKit coordinate-space, NOT CoreAnimation's unit coordinate-space.
Expand Down
4 changes: 2 additions & 2 deletions MapboxNavigation/NavigationViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -492,11 +492,11 @@ extension NavigationViewController: RouteMapViewControllerDelegate {
return delegate?.navigationMapView?(mapView, shapeFor: waypoints)
}

func navigationMapView(_ mapView: MGLMapView, imageFor annotation: MGLAnnotation) -> MGLAnnotationImage? {
public func navigationMapView(_ mapView: MGLMapView, imageFor annotation: MGLAnnotation) -> MGLAnnotationImage? {
return delegate?.navigationMapView?(mapView, imageFor: annotation)
}

func navigationMapView(_ mapView: MGLMapView, viewFor annotation: MGLAnnotation) -> MGLAnnotationView? {
public func navigationMapView(_ mapView: MGLMapView, viewFor annotation: MGLAnnotation) -> MGLAnnotationView? {
return delegate?.navigationMapView?(mapView, viewFor: annotation)
}

Expand Down
4 changes: 2 additions & 2 deletions MapboxNavigation/RouteMapViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -649,11 +649,11 @@ extension RouteMapViewController: NavigationViewDelegate {
}

func navigationMapView(_ mapView: MGLMapView, imageFor annotation: MGLAnnotation) -> MGLAnnotationImage? {
return delegate?.mapView?(mapView, imageFor :annotation)
return delegate?.navigationMapView?(mapView, imageFor: annotation)
}

func navigationMapView(_ mapView: MGLMapView, viewFor annotation: MGLAnnotation) -> MGLAnnotationView? {
return delegate?.mapView?(mapView, viewFor: annotation)
return delegate?.navigationMapView?(mapView, viewFor: annotation)
}

func navigationMapViewUserAnchorPoint(_ mapView: NavigationMapView) -> CGPoint {
Expand Down

0 comments on commit 9ba5f68

Please sign in to comment.