У меня есть пользовательский класс, который расширяет NSObject
и реализует протокол MKOverlay
. В результате мне нужно реализовать свойство boundingMapRect
протокола, которое является MKMapRect
. Чтобы создать MKMapRect
, я могу, конечно, использовать MKMapRectMake
для его создания. Тем не менее, я не знаю, как создать MKMapRect
, используя данные, которые у меня есть, это две точки, каждая из которых задана широтой и долготой. MKMapRectMake
docs:
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
должен будет указать область, которая выглядит примерно так:
Итак, чтобы повторить, как мне использовать значения lat/lon для создания MKMapRect
, который я могу установить как свойство MKOverlay
protocol @property (nonatomic, readonly) MKMapRect boundingMapRect
?