开发者

Objective C: (NSSet *)annotationsInMapRect:(MKMapRect) mapRect method returns null value

开发者 https://www.devze.com 2023-03-03 22:43 出处:网络
I am trying to implement the following method in my application NSSet *nearbySet = [self.mapView annotationsInMapRect:self.mapView.visibleMapRect];

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":

  1. What is the value of self.mapView? Make sure it isn't nil.
  2. What does self.mapView.annotations contain?
  3. What is the value of self.mapView.visibleMapRect?
0

精彩评论

暂无评论...
验证码 换一张
取 消