- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id ) annotation{
MKPinAnnotationView *annView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"pin"];
annView.animatesDrop =TRUE;
[annView setSelected:YES];
annView.pinColor = MKPinAnnotationColorRed;
[annView addObserver:self forKeyPath:@"selected" options:NSKeyValueObservingOptionNew context:nil];
return annView;
}
When we select the Annotation pin then it call following method
- (void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary *)change
context:(void *)context{
// here we can put the code for moving next view
}
MKPinAnnotationView *annView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"pin"];
annView.animatesDrop =TRUE;
[annView setSelected:YES];
annView.pinColor = MKPinAnnotationColorRed;
[annView addObserver:self forKeyPath:@"selected" options:NSKeyValueObservingOptionNew context:nil];
return annView;
}
When we select the Annotation pin then it call following method
- (void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary *)change
context:(void *)context{
// here we can put the code for moving next view
}
I might be wrong, but shouldn't you autorelease annView ?
ReplyDeleteMKPinAnnotationView *annView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"pin"] autorelease];
This comment has been removed by the author.
ReplyDelete