Objective C: (NSSet *)annotationsInMapRect:(MKMapRect) mapRect method returns null value
I am trying to implement the following method in my application
NSSet *nearbySet = [self.mapView annotationsInMapRect:self.mapView.visibleMapRect];
I see in my mapView there ar开发者_运维问答e 4 annotations, however, the method returns me 0 values in the set.
Can anyone advise if I have missed out on anything here?
Thanks in advance.
Zhen
Three quick things to check as a "sanity check":
- What is the value of self.mapView? Make sure it isn't nil.
- What does self.mapView.annotations contain?
- What is the value of self.mapView.visibleMapRect?
精彩评论