2

I'm using the J4n0 Callout code (github) to implement a custom annotation in MapKit.

It was working just fine on iOS5. But on iOS6 I have 2 problems:

  1. Annotations are displayed over the AnnotationView (see picture 1).
  2. The first Click on an Annotation opens the AnnotationView just fine, but the second click opens an annotation with a bad size (see picture 2).

Does anyone using this library have some similar problem/solution?

I can give some code if needed!

annotation on the view bad size

newfurniturey
  • 37,556
  • 9
  • 94
  • 102
Thomas Besnehard
  • 2,106
  • 3
  • 25
  • 47
  • check this lin it may help you..... http://stackoverflow.com/questions/13598739/custom-callout-not-displayed-correctly-in-ios6/13716621#13716621 – 08442 Dec 05 '12 at 08:25

2 Answers2

2

If annotations are displayed over the AnnotationView try to code:

- (void)didMoveToSuperview {
    [super didMoveToSuperview];
    [self.superview bringSubviewToFront:self];
}

Just in case above solution doesn't work try

view.layer.zposition = 1
Janak Nirmal
  • 22,706
  • 18
  • 63
  • 99
Sibear
  • 228
  • 1
  • 6
  • I used your `didMoveToSuperview` into my `MKAnnotationView` and it is working, my annotations are not over my annotationView anymore, thank you very much for that. But it seem to be a patch to force things right, that doesn't explain why it was not working at the first time. Apple seem to have change the way to manage Annotations and Maps, does anyone know how, and what's the right way to manage them now ? – Thomas Besnehard Oct 01 '12 at 08:07
  • 1
    http://stackoverflow.com/questions/13598739/custom-callout-not-displayed-correctly-in-ios6/13716621#13716621 – 08442 Dec 05 '12 at 08:27
  • 1
    bringSubviewToFront did not work well for me. I instead used view.layer.zposition = 1 and that pushed the view on top of everything in the map. – Pauls Oct 24 '13 at 17:29
-1

I am not sure whether you used the same code as mine, I downloaded it from somewhere to custom the annotationView and I also figured out that in the second time, the size is incorrect. I had noticed that the removeAnnotation function, will also make the annotationView call its didMoveToSuperview once again! Then I dug into the codes in didMoveToSuperview and found that the codes that I downloaded (i hope u meet the same one), do some animation in it so this will make the animation codes call twice. That makes the problem that "second click open an annotation with a bad size"

So remove this animation codes, or make it call somewhere else and NOT in didMoveToSuperview but properly. I hope this will help you, and hope you will share your advice if find out that I am wrong.

SnareChops
  • 13,175
  • 9
  • 69
  • 91