Convert span value into meters on a mapview

前端 未结 6 829
小鲜肉
小鲜肉 2020-12-13 06:56

Whenever the user zoom in or out the map i need to know how many meters are currently represented on the map (width or height).

What i need is the inverse function o

6条回答
  •  情书的邮戳
    2020-12-13 07:45

    Here's an easier way (to get width and height in meters)...

    - (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated {
    
        MKMapRect rect = mapView.visibleMapRect;
    
        double mapWidth = MKMapRectGetWidth(rect) / 10;
        double mapHeight = MKMapRectGetHeight(rect) / 10;
    
    }
    

提交回复
热议问题