You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
hide the mapview by pushing another UIViewcontroller over it
pop the pushed view controller
Expected behavior
Content insets should be the same as before
Actual behavior
Content insets are reverted to 0, and further attempts to set the content insets are ineffective.
The gif shows the original inset offsetting the map center downwards, after showing and removing another view controller, the map has been displaced upwards. Any resetting of the insets from this point on is ineffective.
The problem appears to be caused by the MGLMapView#layoutSubviews() which has this code:
- (void)layoutSubviews
{
// Calling this here instead of in the scale bar itself because if this is done in the
// scale bar instance, it triggers a call to this `layoutSubviews` method that calls
// `_mbglMap->setSize()` just below that triggers rendering update which triggers
// another scale bar update which causes a rendering update loop and a major performace
// degradation. The only time the scale bar's intrinsic content size _must_ invalidated
// is here as a reaction to this object's view dimension changes.
[self.scaleBar invalidateIntrinsicContentSize];
[super layoutSubviews];
[self adjustContentInset];
And in turn adjustContentInset() is overwriting the previous insets.
I notice that adjustContentInset() is referencing viewController.automaticallyAdjustsScrollViewInsets which is a deprecated property. Setting to to false on the viewcontroller makes this problem go away, but creates others.
I have been able to get this to work by setting viewController.automaticallyAdjustsScrollViewInsets to false but this is a kludge, since that property is deprecated and in any case was only intended for use where the view is contained in a UIScrollView. IMHO the functionality of shifting the map logical center point should be separated from any requirement to provide content insets for other purposes, e.g. respecting safe area layout guides.
Activity
clydebarrow commentedon Jun 2, 2018
This behaviour was not observed on SDK 3.7
clydebarrow commentedon Jun 3, 2018
The problem appears to be caused by the
MGLMapView#layoutSubviews()which has this code:And in turn
adjustContentInset()is overwriting the previous insets.I notice that
adjustContentInset()is referencingviewController.automaticallyAdjustsScrollViewInsetswhich is a deprecated property. Setting to to false on the viewcontroller makes this problem go away, but creates others.clydebarrow commentedon Jun 8, 2018
I have been able to get this to work by setting
viewController.automaticallyAdjustsScrollViewInsetsto false but this is a kludge, since that property is deprecated and in any case was only intended for use where the view is contained in a UIScrollView. IMHO the functionality of shifting the map logical center point should be separated from any requirement to provide content insets for other purposes, e.g. respecting safe area layout guides.julianrex commentedon Jun 21, 2018
/cc @frederoni
stale commentedon Dec 18, 2018
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.