An MKMapRect
uses MKMapPoint
units which are not the same thing as CLLocationDegrees
.
The MKMapRectMake
function needs the top-left MKMapPoint
and then the width and height (again in MKMapPoint
units).
Basically, you need to use the the MKMapPointForCoordinate
function to help you do this conversion from degrees to MKMapPoint
units.
First, you could construct an MKCoordinateRegion
and then convert it to an MKMapRect
.
For example:
//create a region 10km around the annotation...
MKCoordinateRegion mapRegion = MKCoordinateRegionMakeWithDistance
(annotation.coordinate, 10000, 10000);
//convert the MKCoordinateRegion to an MKMapRect...
MKMapRect mapRect = [self mapRectForCoordinateRegion:mapRegion];
The mapRectForCoordinateRegion
method is something you have to write.
For an example of one way to write it, see this answer:
How to make the union between two MKCoordinateRegion
By the way, note that in your case, annotationsInMapRect
will include the annotation that you are searching around (since you are using it as the center).