[iOS] Scrolling mapView before loading finish
I'm using an instance of MGLMapView with a custom style in a viewController. Before mapView load finishes when mapView still is empty, If I scroll the empty mapView before mapViewDidFinishLoadingMap method is called, It does not show my custom style and it will remain empty. I do not know why it happens. To solve this issue I set mapView isUserInteractionEnabled to false and in mapViewDidFinishLoadingMap method, change it to true.
override func viewDidLoad() {
super.viewDidLoad()
mapView = MGLMapView(frame: view.bounds, styleURL: URL(string: "myCustomStyleURL.json"))
mapView?.autoresizingMask = [.flexibleWidth, .flexibleHeight]
mapView?.showsUserLocation = true
mapView?.delegate = self
mapView?.isUserInteractionEnabled = false
...
}
func mapViewDidFinishLoadingMap(_ mapView: MGLMapView) {
mapView.isUserInteractionEnabled = true
}
Steps to reproduce
- scroll mapView before it loading finish (when it still is empty)
- after func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) {}
- before func mapViewDidFinishLoadingMap(_ mapView: MGLMapView) { }
Actual behavior
- The mapview will remain empty and won't show style.
Configuration
Mapbox SDK versions: 4.4 iOS/macOS versions: 11.1.2 and 12.0.1 Device/simulator models: iPhone 6s and iPhone 8 Xcode version: 10
Thanks for the report @hastiranjkesh!
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.