I have a list of several hundred locations and only want to display an MKPinAnnotation for those locations currently on the screen. The screen starts with the user\'s curren
In your code, you should pass a view for the toPointToView: option. I gave it my mapView. You have to specify an upper bound for the x and y too.
Here's some code which worked for me (told me the currently visible annotations on my map, while looping through the annotation):
for (Shop *shop in self.shops) {
ShopAnnotation *ann = [ShopAnnotation annotationWithShop:shop];
[self.mapView addAnnotation:ann];
CGPoint annPoint = [self.mapView convertCoordinate:ann.coordinate
toPointToView:self.mapView];
if (annPoint.x > 0.0 && annPoint.y > 0.0 &&
annPoint.x < self.mapView.frame.size.width &&
annPoint.y < self.mapView.frame.size.height) {
NSLog(@"%@ Coordinate: %f %f", ann.title, annPoint.x, annPoint.y);
}
}