【发布时间】:2019-02-04 06:52:27
【问题描述】:
我有一个自定义类,它扩展了NSObject 并实现了MKOverlay 协议。因此,我需要实现协议的boundingMapRect 属性,即MKMapRect。要创建一个MKMapRect,我当然可以使用MKMapRectMake 来创建一个。但是,我不知道如何使用我拥有的数据创建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 需要指定一个看起来像这样的区域:
所以,重申一下,我如何使用我的纬度/经度值来创建一个MKMapRect,我可以将其设置为MKOverlay 协议的@property (nonatomic, readonly) MKMapRect boundingMapRect 属性?
【问题讨论】: