我有一个自定义类,它扩展了NSObject
并实现了MKOverlay
协议。因此,我需要实现协议的boundingMapRect
属性,它是一个MKMapRect
。当然,我可以使用MKMapRectMake
来创建一个MKMapRect
。但是,我不知道如何使用我拥有数据创建MKMapRect
,这些数据是两个点,每个点由一个纬度和一个经度指定。MKMapRectMake
的文档状态:
MKMapRect MKMapRectMake(
double x,
double y,
double width,
double height
);
Parameters
x
The point along the east-west axis of the map projection to use for the origin.
y
The point along the north-south axis of the map projection to use for the origin.
width
The width of the rectangle (measured using map points).
height
The height of the rectangle (measured using map points).
Return Value
A map rectangle with the specified values.
我必须指定MKMapRect
的纬度和经度值是:
24.7433195, -124.7844079
49.3457868, -66.9513812
因此,目标MKMapRect
需要指定一个如下所示的区域:
因此,重申一下,如何使用经度/纬度值创建一个可以设置为MKOverlay
协议@property (nonatomic, readonly) MKMapRect boundingMapRect
属性的MKMapRect
?
https://stackoverflow.com/questions/24024135
复制相似问题