-
Notifications
You must be signed in to change notification settings - Fork 1.3k
MapBox in UIScrollView, scrolling behavior #7217
Comments
There has not been any activity for this issue. Do I need to provide more input? This problem is very annoying and we have not been able to find a workaround either. I have not tried any of the latest builds, but I assume that if this problem would have been corrected - it should somehow be noted here. Thanks, |
Hi @standers67, it would be useful if you could:
If you haven’t already, you might also try different means of disabling the map view’s interactivity. Specifically:
|
Hi Jason / MapBox,
Thanks for coming back so quickly regarding this.
The easiest way to reproduce the problem, is to add a UIScrollView to a regular ViewController. In the scrollview, you then add a MGLMapBox (together with other content, to make sure that the content is larger than the current view).
We have found that when we use any of the methods provided to prevent panning the Mapboxview, the touch events are not forwarded to the underlying UIScrollView. To be able to scroll, you must either touch the area just above or below the map.
The problem should be really easy to re-create, if you find it necessary it can surely create a small project that illustrates the issue.
Please let me know if I have been able to clearly describe the issue, or if there are more details that I need to explain.
Thanks a lot,
Stefan
|
@standers67 @friedbunny could a possible workaround be to iterate through the map view's gesture recognizers, find the one that is a kind of I also wonder if it may be worth opening a ticket to change |
Actually, this should not be necessary since setting Otherwise, I think that disabling just the relevant recognizers when APIs like |
I think both using |
Just as follow-up to this problem. If we use the userInteractionEnabled = NO, it actually works in one aspect, but then we have the issue that we cannot respond to map annotation events. Our mapView have annotations that the users can interact with. This does not work if we completely disable user interaction with the mapView. |
To clarify, would setting |
That was what we tried initially, but the problem was then that the scrolling gesture was not sent to the underlying scrollView that the mapBox is contained in. Have any changes been made in the component to fix this problem? We are not running on the very latest release, but if nothing has been changed in the component, it would probably not matter. |
…ng user interactivity. Fixes mapbox#7217 Added an example behavior of MGLMapView as a subview of UIScrollView in iOS app.
…ng user interactivity. Fixes #7217 Added an example behavior of MGLMapView as a subview of UIScrollView in iOS app.
**Platform: iOS 10
**Mapbox SDK version: 3.3.7
We have an IOS project where we have migrated to the MapBox iOS SDK, currently on version 3.3.7
We have identified one behavior related to the scrolling that differs from the MKMapView. We want to present the map without letting the user pan (scroll) the map. For this we set the property self.mapView.allowsScrolling to NO. This works as intended, the user is not able to pan the map.
However, the problem we have is that the MGLMapView is presented in a UIScrollView. When we have disabled the scrolling as above, the map seems to ignore the swipe gesture that would normally be detected by the UIScrollView.
To scroll the view presented in the scrollview you need to touch the screen either above or below the MGLMapView. Swiping on the map do not cause the UIScrollView to move.
This works with the regular MKMapView, setting the scrolling to disabled there, still let it send the received gestures to the underlying UIScrollView.
The text was updated successfully, but these errors were encountered: