削除して再度追加する必要はありません。カスタム注釈ビューを変更して を呼び出すだけsetNeedsDisplay
です。例:
@interface AnnotationClusterView : MKAnnotationView {
@property (nonatomic, assign) int badgeNumber;
}
@implementation AnnotationClusterView
@synthesize badgeNumber;
// ...
- (void)drawRect:(CGRect)rect {
NSString *string = [NSString stringWithFormat:@"%d",self.badgeNumber];
[string drawInRect:stringRect withFont:[UIFont fontWithName:@"Helvetica-Bold" size:13.0]];
}
@end
ズームが変更されたら、MKAnnotationView への参照を取得し、別の BadgeNumber を設定して、再描画呼び出しを要求し[myView setNeedsDisplay];
ます。画像についても同じことができます。