2

enter image description here

when we click on customized annotation pin, the calloutview not displayed in center of the view, rather showing half in the view and remaining out of the view. pls help me anybody. thanks in advance

    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;
}
ThiefMaster
  • 310,957
  • 84
  • 592
  • 636
Venkat
  • 33
  • 4
  • take a look at below Stackoverflow's answers: 1) http://stackoverflow.com/a/16706675/2695503 2) http://stackoverflow.com/a/16767124/2695503 might be helpful – D-eptdeveloper Sep 03 '13 at 05:25

1 Answers1

0
annotationView.centerOffset = CGPointMake( annotationView.centerOffset.x + annotationView.image.size.width/2, annotationView.centerOffset.y - annotationView.image.size.height/2 );

Add these lines in below mentioned delegate method.

- (MKAnnotationView *)mapView:(MKMapView *)theMapView viewForAnnotation:(id <MKAnnotation>)annotation
Himanshu
  • 421
  • 3
  • 10