Repository navigation
Ignore non-conforming user location annotation views - #6163
Conversation
|
|
||
| The user location annotation view can also be customized via this method. When | ||
| `annotation` is `MGLUserLocation`, return an instance of a custom | ||
| `MGLUserLocationAnnotationView` subclass. |
There was a problem hiding this comment.
Returning an MGLUserLocationAnnotationView should be acceptable too, thanks to https://github.com/mapbox/mapbox-gl-native/pull/6163/files#diff-20502b6bc02986a4398d0da84b2d4b94R3827.
There was a problem hiding this comment.
You are correct! How about this, then:
The user location annotation view can also be customized via this method. When
`annotation` is `MGLUserLocation`, return an instance of
`MGLUserLocationAnnotationView` (or a subclass thereof).
There was a problem hiding this comment.
Sounds good. To be pedantic:
s/is MGLUserLocation/is an instance of MGLUserLocation (or equal to the map view's userLocation property)/
8f75ffb to
590a798
Compare
There was a problem hiding this comment.
To avoid spamming the console, this message should only occur once per map view or once per process (and it should say so).
There was a problem hiding this comment.
Also, this message should include the view’s actual class, to aid in debugging.
There was a problem hiding this comment.
af771e0 limits the warning to being shown once and adds the name of the incorrect view to the text.
11018e3 to
9fcf669
Compare
- Add note to mapView:viewForAnnotation: delegate method. - Edit docs in iosapp's implementation of that delegate method.
9fcf669 to
8dff7ab
Compare

Prior to v3.4.0, a developer could indiscriminately return any UIView-conforming object in
mapView:viewForAnnotation:and everything would be fine. With custom user location annotation views, we now also pass in aMGLUserLocationannotation, which requires a view that conforms toMGLUserLocationAnnotationView.This pull request ignores views that the developer nominated for the user location annotation view that are not actually a kind of
MGLUserLocationAnnotationView. This changes the alpha.2 behavior of asserting when the inheritance was wrong. When we ignore a view, the default user dot is used in its stead.I’ve also documented that
mapView:viewForAnnotation:can be used to customize the user location annotation view, because this is a somewhat unexpected new behavior.Fixes #6100.
/cc @1ec5 @frederoni