Using IBAction Buttons to Zoom MapView

前端 未结 6 1573
谎友^
谎友^ 2021-01-02 17:17

I have an issue. My current location is displayed and centered in a map view however the map region doesn\'t get zoomed in to. I tried taking Rob\'s advice by taking span an

6条回答
  •  温柔的废话
    2021-01-02 17:51

    You could achieve the most basic in 3 lines of code

    var region: MKCoordinateRegion = self.mapView.region
    region = MKCoordinateRegionMake(self.mapView.centerCoordinate, MKCoordinateSpanMake(0.005, 0.005));
    self.mapView.setRegion(region, animated: true)
    

提交回复
热议问题