4

I'm encountering a mystery issue when selecting a pin in the mapview iOS6 enter image description here

BTW, it works correctly in iOS 5, i'm not sure what they changed in the map of iOS 6 that produce this issue.

NOTE that when I click on the map, the callout directly go over the pins and shows correctly

any help/clue would be appreciated,

Thanks in advance

Charles
  • 50,943
  • 13
  • 104
  • 142
Maystro
  • 2,907
  • 8
  • 36
  • 71
  • Check this link it may help you some what... http://stackoverflow.com/questions/13598739/custom-callout-not-displayed-correctly-in-ios6/13716621#13716621 – 08442 Dec 05 '12 at 08:26

4 Answers4

6

the answer might vary a bit depending on how you're implementing your custom callout bubble. This was/is the solution I'm using: Customize the MKAnnotationView callout and I ran into the exact same problem.

Basically, everytime the callout is going to show, I had to bring the subview to the front.

In this case, my custom callout bubble is a class called 'BaseCalloutView' which contains a UIView as its ContentView property (as you can see in the UML diagram at the link above). When the annotation is selected, it triggers the 'animateIn' function of the BaseCalloutView, into which I added:

[self.superview bringSubviewToFront:self];

As I mentioned, your mileage may vary depending on how you're implementing the custom callout bubble. I can provide you with the full code if needed - but to be honest 90% of my code is from the link above.

Community
  • 1
  • 1
Jai Govindani
  • 3,181
  • 21
  • 26
  • actually, I implemented the delegate region methods of the map aand i put this code within them and also i added this code([self.superview bringSubviewToFront:self]) after drawing the rect of the callout, it works in most cases but the issue still happens when keep clicking on the map while the callout is displayed, the pins that i already clicked on still appears over the callout when I left my hand they returns back to callout. i think weird something is happening when trying to change the region of the map!!! – Maystro Sep 26 '12 at 10:31
  • When you say you're clicking on the map when the callout is displayed - does this mean that clicking on the map doesn't dismiss the callout for you? Technically this should be equivalent to deselecting the annotation and hiding the callout bubble. – Jai Govindani Sep 26 '12 at 10:33
  • yes, it is equivalent to deselecting the annotation but the issue appears when I click on the map and keep my finger on the screen. when releasing it the issue disappear and that make sense since i added [self.superview bringSubviewToFront:self] to 2 delegate region method of the map, but how can i figure out why the problem still appear while keeping my finger clicking the map – Maystro Sep 26 '12 at 11:05
  • I'll try to re-create this issue in my code, given that your approach is different from mine, I'll see what I can find out. Off the top of my head, I would say that you may be removing and re-adding annotations somewhere that is causing them to be re-added on top of your custom callout bubble, or the annotations that are showing up on top are somehow being brought to the front by the same code you're using to bring the callout to the front. – Jai Govindani Sep 28 '12 at 16:46
  • If you could post/share the code you're using for this particular implementation, that would help. – Jai Govindani Sep 28 '12 at 16:53
0

This solution didn't work for me, however the one did:

Custom Annotation View do not work on iOS6

Sorry not sure how to link answers properly.

Community
  • 1
  • 1
Brett
  • 1,647
  • 16
  • 34
  • http://stackoverflow.com/questions/13598739/custom-callout-not-displayed-correctly-in-ios6/13716621#13716621 – 08442 Dec 05 '12 at 08:27
0

In IOS 5 and IOS 6 , I try this and it's ok

the pin never overlap CalloutView. I use custom calloutview , in file Base calloutView I add this :

 - (void)didMoveToSuperview {
        [super didMoveToSuperview];
        [self.superview bringSubviewToFront:self];
    }
THT
  • 11
  • 1
0

I am using same code base, got same problem. [self.superview bringSubviewToFront:self]; doesn't work for me, not matter where did I put it. [annimateIn] or [didMoveToSuperView] or [layoutIfNeeded]

Because this problem went away by finger moving the map a little bit, so I found it is very easy to simulate this effect by put code in - (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view. The offset is very small, no visual movement can be noticed at all.

    CLLocationCoordinate2D newCenterCoordinate = {self.mapView.region.center.latitude + 0.0000001,
        self.mapView.region.center.longitude + 0.0000001};

    [self.mapView setCenterCoordinate:newCenterCoordinate animated:NO];
frank.m
  • 558
  • 5
  • 5