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.
Wrong attribution positioning after resizing MGLMapView via constraints #6568
There seems to be an issue when resizing an MGLMapView via AutoLayout constraints during a custom view controller transition animation that breaks the layout of the attribution views that are normally at the bottom corners. My view controller transition consists of expanding the map view full screen from a smaller frame in the presenting profile/detail controller.
During the transition, the MGLMapView instance from the detail/profile controller is added as a subview of the destination/target view controller after which the necessary AutoLayout constraints are setup and then animated from the starting frame to the destination (full screen) frame. It appears that perhaps changing the map view's parent in this process may be breaking the position of the logo and attribution views at the bottom of the map.
When working with Mapbox support a few months ago on the issue, it was believed the cause was related to this issue. But the latest SDK versions still have the issue.
Here's a screen capture of the issue:
Platform: iOS 8.0+
Mapbox SDK: 3.3.4
Here's condensed version of the code that performs this presentation transition animation via the UIViewControllerAnimatedTransitioning protocol:
lettoViewController=toViewControllerInContext(transitionContext)lettargetViewController=targetViewControllerForKey(UITransitionContextToViewControllerKey,inContext:transitionContext)transitionContext.containerView().addSubview(toViewController!.view)
if letmapController=targetViewControlleras?MapViewController,mapView=mapController.mapView{mapController.view.layoutIfNeeded()letoriginalMapSuperview=mapView.superviewlettargetMapFrame=mapController.mapContainerView.convertRect(originalMapSuperview!.frame,fromView:originalMapSuperview!.superview!)mapController.mapContainerView.addSubview(mapView)varmapHeightConstraint:NSLayoutConstraint?varmapTopConstraint:NSLayoutConstraint?constrain(mapView){viewinview.left==view.superview!.leftview.right==view.superview!.rightmapHeightConstraint=(view.height==CGRectGetHeight(targetMapFrame))mapTopConstraint=(view.top==view.superview!.top+CGRectGetMinY(targetMapFrame))}mapHeightConstraint?.constant=CGRectGetHeight(mapController.mapContainerView.frame)mapTopConstraint?.constant=0UIView.animateWithDuration(transitionDuration(transitionContext),delay:0,options:UIViewAnimationOptions.CurveEaseInOut,animations:{()->VoidinmapController.view.layoutIfNeeded()},completion:{(finished)->VoidintransitionContext.completeTransition(true)})}
Expected behavior
The map view's attribution views should remain pinned to the bottom corners of the map when animating its layout constraints.
Actual behavior
The map view's attribution views break their layout when animating the map view's layout constraints.
#7084 most likely resolved this issue but there's a lot going on #6568 (comment) here with custom transitions so another test using the latest beta version of the SDK would be great. Though it's not only the attribution that's misaligned/missing but the speed of the animation when resizing the map view's frame is not in sync with the constraints if I'm not mistaken? (#6568 (comment))
Yes, the issue is the discrepancy between frame animations, which makes the map reveal the background.
I'll give it a go with the Beta SDK as soon as I get a chance
Activity
1ec5 commentedon Oct 7, 2016
This may be related to the ambiguous constraint warnings we’re seeing for the ℹ️ button, compass view, etc.: #5549.
ketz commentedon Nov 16, 2016
@u10int - did you ever find a way to improve that animation?
Having the exact same problem, and it makes it look really bad when animating.
1ec5 commentedon Nov 16, 2016
#6776 fixes some issues with the map view's internal constraints, but some known problems remain: #6954.
One workaround for your issue may be to hide the compass, logo view, and attribution button during the animation and show them again afterwards.
ketz commentedon Nov 16, 2016
@1ec5 - sadly, hiding those (even permanently to test properly), didn't work.
Here's a quick video to show it happening (with a red background on the map view to highlight the issue):
https://dl.dropboxusercontent.com/u/1977230/MapboxBug.mp4
friedbunny commentedon Dec 12, 2016
@frederoni Any sense if #7084 (or other related changes) address this issue?
frederoni commentedon Dec 12, 2016
#7084 most likely resolved this issue but there's a lot going on #6568 (comment) here with custom transitions so another test using the latest beta version of the SDK would be great. Though it's not only the attribution that's misaligned/missing but the speed of the animation when resizing the map view's frame is not in sync with the constraints if I'm not mistaken? (#6568 (comment))
ketz commentedon Dec 13, 2016
Yes, the issue is the discrepancy between frame animations, which makes the map reveal the background.
I'll give it a go with the Beta SDK as soon as I get a chance
lilykaiser commentedon Nov 17, 2017
Closing due to ticket age. If this is still a problem, please re-open