This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
Automatically find view controller for layout guides #1357
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We inherited an annoying, easy-to-overlook setup step from the iOS SDK:
MGLMapView
’sviewControllerForLayoutGuides
outlet must be hooked up to the managing view controller in order for the ornaments (logo, ℹ️, compass) to be laid out properly.Based on the
-[UIResponder nextResponder]
documentation and the fixes for ornament layout in #1328, this PR causesMGLMapView
to compute the managing view controller on its own by traversing the responder chain. (If there is a legitimate need to lay out the ornaments based on some view controller not in the responder chain, that would be a good opportunity to subclassMGLMapView
; in that case, we’d need to re-expose-viewControllerForLayoutGuides
publicly, but there would still be no need for a stored property.)Once this PR is merged and contained in a tag, I’ll remove the step from the installation guide.
/cc @incanus @friedbunny