
当我们点击自定义注解别针时,calloutview不会显示在视图的中心,而是显示在视图中的一半,而保留在视图之外。请任何人帮助我。提前感谢
CGSize const kMultiRowCalloutCellSize = {300,140};
- (id)initWithAnnotation:(id<MultiRowAnnotationProtocol>)annotation reuseIdentifier:(NSString *)reuseIdentifier onCalloutAccessoryTapped:(MultiRowAccessoryTappedBlock)block {
self = [super initWithAnnotation:(id<MKAnnotation>)annotation reuseIdentifier:reuseIdentifier];
if (self) {
self.contentHeight = 80.0;
_yShadowOffset = 6;
self.offsetFromParent = CGPointMake(78, -14); //this works for MKPinAnnotationView
self.enabled = NO;
self.backgroundColor = [UIColor clearColor];
self.cellInsetX = 15;
self.cellOffsetY = 10;
self.onCalloutAccessoryTapped = block;
[self setTitleWithAnnotation:annotation];
[self setCalloutCellsWithAnnotation:annotation];
}
return self;
}发布于 2014-04-25 18:52:23
annotationView.centerOffset = CGPointMake( annotationView.centerOffset.x + annotationView.image.size.width/2, annotationView.centerOffset.y - annotationView.image.size.height/2 );在下面提到的委托方法中添加这些行。
- (MKAnnotationView *)mapView:(MKMapView *)theMapView viewForAnnotation:(id <MKAnnotation>)annotationhttps://stackoverflow.com/questions/18584442
复制相似问题