diff --git a/platform/ios/src/MLNMapView+Metal.mm b/platform/ios/src/MLNMapView+Metal.mm index d17bd09be..67b4a4313 100644 --- a/platform/ios/src/MLNMapView+Metal.mm +++ b/platform/ios/src/MLNMapView+Metal.mm @@ -157,7 +157,7 @@ void MLNMapViewMetalImpl::createView() { } id device = (__bridge id)resource.getBackend().getDevice().get(); - const auto scaleFactor = MLNEffectiveScaleFactorForView(resource.mtlView); + const auto scaleFactor = MLNEffectiveScaleFactorForView(mapView); resource.mtlView = [[MTKView alloc] initWithFrame:mapView.bounds device:device]; resource.mtlView.delegate = resource.delegate; @@ -217,9 +217,15 @@ UIImage* MLNMapViewMetalImpl::snapshot() { void MLNMapViewMetalImpl::layoutChanged() { const auto scaleFactor = MLNEffectiveScaleFactorForView(mapView); - const auto screenSize = mapView.window.screen.nativeBounds.size; - size = { static_cast(screenSize.width * scaleFactor), - static_cast(screenSize.height * scaleFactor) }; + const auto screenSize = mapView.bounds.size; + + auto& resource = getResource(); + + resource.mtlView.contentScaleFactor = scaleFactor; + resource.mtlView.drawableSize = CGSizeMake(screenSize.width * scaleFactor, screenSize.height * scaleFactor); + + size = { static_cast(resource.mtlView.drawableSize.width), + static_cast(resource.mtlView.drawableSize.height) }; } MLNBackendResource* MLNMapViewMetalImpl::getObject() {