2011-11-28 16 views

答えて

1

私はdidAddAnnotationViewsコールバックを使用して求めているものです:あなたはこれらの注釈をソートしたいんどのような基準で

- (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views { 
     for (MKAnnotationView * annView in views) { 
     if ([annView.annotations isTop]) { 
      [[annView superview] bringSubviewToFront:annView]; 
     } else {   
      [[annView superview] sendSubviewToBack:annView]; 
     } 
    }  
} 
1

基本的mapView.annotationsがあなたの注釈をソート役立ちます、あなたにNSArrayであなたのすべての注釈へのアクセス権を与え、その後、sortedArray ...メソッド(there are lots of different one)を使用します

NSArray *sortedArray = [mapView.annotations sortedArrayUsingComparator:<#^NSComparisonResult(id obj1, id obj2)cmptr#>]; 

、このような何かを試してみてください新しいソートされたNSArryを返します。

希望、これはあなたが、MKMapViewの上に注釈をソートするための

乾杯

関連する問題