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.
Allow watermark and info button to be moved (iOS) #1781
Given visual effect views in iOS 8+, sometimes maps need to extend below a UIView to affect the view's background color dynamically. Unfortunately this hides the required watermark in some instances. Even though the intent is non-malicious, it causes a violation of the TOS.
Users need to somehow configure where the logo is shown, even if it's just something as simple as an offset from the bottom.
MGLMapView currently knows to offset the ornaments (including the compass, obscured above by the 3D button) to make room for standard top and bottom bars. It would be reasonable to add an additional offset for custom views like this.
I wonder if if we can be more general about it and expose connecting to the top/bottom layout guide-related stuff that we have now (e.g. here is the compass' constraint against the top layout guide).
@incanus, you mean like being able to make the logo stick to the top of the view instead of the bottom, or like calling an optional delegate method to do the dirty work of setting up the constraints?
Once maps start being integrated into the design of production apps, what is needed is complete control over the placement of the overlays (logos, compass, etc.) Pretty much every layout we have in our app does not work with the given overlay locations. I think it's more than pushing an element up or down, but rather being able to fully customize the layout. At this point, we removed them all and will add back the required attribution in a different way.
At this point, we removed them all and will add back the required attribution in a different way.
Thanks for adapting this @picciano — this is common practice with the raster tools, too, though they have the exposed APIs to make it more direct. Attribution elsewhere in the app is fine.
Thanks @incanus! But a lot of the credit goes to you guys. These maps are looking great.
And all I heard this past week is "OMG! Lines! The map has LINES!"
While it works ATM and we can now find the constraints in-code (yay, thanks!), I'd recommend not closing this as part of #1815. The code needed to do it feels very brittle. Apps using the SDK shouldn't need to know about how Mapbox is internally setting up layout constraints as that can change at any time.
Example of current code needed to move the logo / button (as a subclass):
The complexity here makes me wonder if we should just punt on this, allowing the user to 1) hide our views, then 2) add & constrain their own. Rather than us expose the constraints or auto-adapt somehow.
From a user perspective I think hiding would be the easiest. Leave it to the user to attribute Mapbox somehow else. I know forecast.io places that responsibility on the user.
@incanus, how about exposing the showAttribution from MGLMapView:L1904 method so we can add our own button but use the ActionSheet you have already implemented?
it seems that in release 3.6.0, the buttons positions are no longer controlled by constraints as described by @parrots. Now, the frames are directly set in layoutOrnaments(), so I'm overriding layoutSubviews() instead of updateConstraints () now and moving the attributionButton this way:
Activity
1ec5 commentedon Jun 23, 2015
MGLMapView currently knows to offset the ornaments (including the compass, obscured above by the 3D button) to make room for standard top and bottom bars. It would be reasonable to add an additional offset for custom views like this.
incanus commentedon Jun 23, 2015
I wonder if if we can be more general about it and expose connecting to the top/bottom layout guide-related stuff that we have now (e.g. here is the compass' constraint against the top layout guide).
1ec5 commentedon Jun 23, 2015
@incanus, you mean like being able to make the logo stick to the top of the view instead of the bottom, or like calling an optional delegate method to do the dirty work of setting up the constraints?
incanus commentedon Jun 23, 2015
No, more like exposing the current constraints to allow for things like Curtis’ custom view to push the bottom views up, for example.
picciano commentedon Jun 23, 2015
Once maps start being integrated into the design of production apps, what is needed is complete control over the placement of the overlays (logos, compass, etc.) Pretty much every layout we have in our app does not work with the given overlay locations. I think it's more than pushing an element up or down, but rather being able to fully customize the layout. At this point, we removed them all and will add back the required attribution in a different way.
incanus commentedon Jun 23, 2015
Thanks for adapting this @picciano — this is common practice with the raster tools, too, though they have the exposed APIs to make it more direct. Attribution elsewhere in the app is fine.
App looks great btw!
picciano commentedon Jun 23, 2015
Thanks @incanus! But a lot of the credit goes to you guys. These maps are looking great.
And all I heard this past week is "OMG! Lines! The map has LINES!"
incanus commentedon Jul 1, 2015
Fixed in #1815.
parrots commentedon Jul 15, 2015
While it works ATM and we can now find the constraints in-code (yay, thanks!), I'd recommend not closing this as part of #1815. The code needed to do it feels very brittle. Apps using the SDK shouldn't need to know about how Mapbox is internally setting up layout constraints as that can change at any time.
Example of current code needed to move the logo / button (as a subclass):
In the above if Mapbox at anytime changes from matching from baseline to bottom, or reverses the order of the items, all this breaks.
incanus commentedon Jul 20, 2015
The complexity here makes me wonder if we should just punt on this, allowing the user to 1) hide our views, then 2) add & constrain their own. Rather than us expose the constraints or auto-adapt somehow.
parrots commentedon Jul 20, 2015
From a user perspective I think hiding would be the easiest. Leave it to the user to attribute Mapbox somehow else. I know forecast.io places that responsibility on the user.
nosyjoe commentedon May 17, 2017
@incanus, how about exposing the
showAttributionfrom MGLMapView:L1904 method so we can add our own button but use the ActionSheet you have already implemented?1ec5 commentedon May 17, 2017
That's a good idea, @nosyjoe! I opened #9024 to track that change and describe a workaround. Please feel free to submit a PR with that change.
nosyjoe commentedon Jul 7, 2017
it seems that in release 3.6.0, the buttons positions are no longer controlled by constraints as described by @parrots. Now, the frames are directly set in
layoutOrnaments(), so I'm overridinglayoutSubviews()instead ofupdateConstraints ()now and moving theattributionButtonthis way:to move it to the bottom left corner (instead of the bottom right)