公告
财富商城
积分规则
提问
发文
2019-07-14 02:36发布
倾城 Initia
I am working on a map app and I want to enable user to zoom out to entire globe. I am using MKMapView. I saw that this feature is available in iOS map app.
Can anyone tell how can I achieve the same in my app.
According to one of Apple's technical support staff, it appears that this view is not accessible using MapKit:
This view is not available through MapKit.
https://forums.developer.apple.com/thread/101479
Change the map to Hybrid Flyover or Satellite Flyover and Enable 3D View from storyboard
Call this function from viewDidLoad updateMapToShowGlobe(location: mapView.centerCoordinate)
// MARK: Snippet to show full globe in 3d view private func updateMapToShowGlobe(location :CLLocationCoordinate2D) { let span = MKCoordinateSpanMake(130, 130) let region = MKCoordinateRegionMake(location, span) if( region.center.latitude > -90 && region.center.latitude < 90 && region.center.longitude > -180 && region.center.longitude < 180 ){ mapView.setRegion(region, animated: true) } }
It's like so sad since there have been so wrong informations down below. It's so easy to do at least in iOS 12, November 2018.
That's all you need to do to get globe view.
either
mapView.mapType = .satelliteFlyover
or
mapView.mapType = .hybridFlyover
(I am not sure and it has no technical basis but it feels like .hybridFlyover shows better performance in my experience)
That's all though :p;; I make sure it works because I did it right before.
I hope you find it useful.
最多设置5个标签!
According to one of Apple's technical support staff, it appears that this view is not accessible using MapKit:
https://forums.developer.apple.com/thread/101479
Change the map to Hybrid Flyover or Satellite Flyover and Enable 3D View from storyboard
Call this function from viewDidLoad updateMapToShowGlobe(location: mapView.centerCoordinate)
It's like so sad since there have been so wrong informations down below.
It's so easy to do at least in iOS 12, November 2018.
That's all you need to do to get globe view.
either
or
(I am not sure and it has no technical basis but it feels like .hybridFlyover shows better performance in my experience)
That's all though :p;;
I make sure it works because I did it right before.
I hope you find it useful.