When I create a bounding box and pass it to fitBounds, I get a small globe in the center of the view.
Code:
override func viewDidLoad() {
super.viewDidLoad()
mapView.delegate = self
// This code works, but I don't want a center point and zoom, I need to specify a region
// let region = SKCoordinateRegion(center: CLLocationCoordinate2DMake(40.697198, -73.883391), zoomLevel: 12)
// mapView.visibleRegion = region
let nyNW = CLLocationCoordinate2DMake(41.722259, -75.650663)
let nySE = CLLocationCoordinate2DMake(40.161297, -71.762025)
let bbox = SKBoundingBox(topLeftCoordinate: nyNW, bottomRightCoordinate: nySE)
mapView.fitBounds(bbox, withPadding: CGSize(width: 20,height: 20))
}
This should show a section of New York. Instead, it shows a globe that does not include the region I specified.
fitBounds.jpg
The region in the bounding box is not
How do I get the map so show a specified region? The specified region should fill the map view.
Thanks!
Bookmarks