MKMapView - 在加载更多结果时未调用viewForAnnotation

Dav*_*ave 3 objective-c mkmapview mkannotation mkannotationview

编辑添加*我还没有找到这个解决方案,有人可以帮忙吗?我的问题与此类似,但发布的答案对我不起作用 - 引脚移动后MKMapView刷新*结束编辑

我有一个启用搜索的地图视图.当用户点击搜索时,我的自定义注释会添加到地图视图中.搜索返回20个带有"加载更多"链接的结果.当我点击加载更多时,应该在地图视图中添加更多注释.

问题是 - 注释会添加到地图视图中,但不会显示在地图上.如果我放大或缩小以更改地图区域,则会显示引脚.

我发现viewForAnnotations:当我点击'加载更多'时没有被调用.我不知道如何触发这个.任何人?

-(void)completedSearch:(NSNotification *)resultNotification
 {
   //begin loop
   //get coordinate
   customAnnotation *annot = [[customAnnotation alloc] initWithCoordinate:coordinate];
   //set title subtitle 
   [annotationsArray addObject:annot];
   //end loop
   [mView addAnnotations:annotationsArray];
   [mView setRegion:region animated:YES];
   [mView regionThatFits:region];
 }

  //custom annotation
  @interface customAnnotation : NSObject <MKAnnotation> 
 { 
   CLLocationCoordinate2D coordinate;  
   NSString*              title; 
   NSString*              info; 
 } 
 @property (nonatomic, retain) NSSting *title;
 @property (nonatomic, retain) NSSting *info;

 -(id) initWithCoordinate:(CLLocationCoordinate2D)c;
 @end

 @implementation customAnnotation
 @synthesize coordinate, title, info;
 -(id) initWithCoordinate:(CLLocationCoordinate2D)c
 {
   coordinate = c;
   return self;
 }
 -(void)dealloc{//dealloc stuff here}
 @end
Run Code Online (Sandbox Code Playgroud)

roo*_*ell 5

只是想确认我是从一个线程添加注释 - 这不起作用.一旦我使用了这个(addCameraIconOnMain添加我的annoations)

[self performSelectorOnMainThread:@selector(addCameraIconOnMain:) withObject:cd waitUntilDone:true];    
Run Code Online (Sandbox Code Playgroud)

它的工作!谢谢!