mapbox-gl-native icon indicating copy to clipboard operation
mapbox-gl-native copied to clipboard

[iOS] Scrolling mapView before loading finish

Open hastiranjkesh opened this issue 8 years ago • 2 comments

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

  1. scroll mapView before it loading finish (when it still is empty)
  2. after func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) {}
  3. 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

hastiranjkesh avatar Oct 29 '18 09:10 hastiranjkesh

Thanks for the report @hastiranjkesh!

julianrex avatar Oct 29 '18 12:10 julianrex

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

stale[bot] avatar Apr 27 '19 20:04 stale[bot]