Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Callout View Jumping When Panning/Zooming #9228

Closed
Kayeee opened this issue Jun 9, 2017 · 5 comments
Closed

Callout View Jumping When Panning/Zooming #9228

Kayeee opened this issue Jun 9, 2017 · 5 comments
Labels
annotations Annotations on iOS and macOS or markers on Android bug iOS Mapbox Maps SDK for iOS

Comments

@Kayeee
Copy link

Kayeee commented Jun 9, 2017

Platform: iOS
Mapbox SDK version: 3.5

Steps to trigger behavior

  1. Make a custom Callout View using MGLCalloutView
  2. set dismissesAutomatically: Bool = false
  3. set isAnchoredToAnnotation: Bool = true

Expected behavior

Callout will stay above annotation and follow it while panning.

screen shot 2017-06-05 at 5 40 44 pm

Actual behavior

Callout drops down about 20 pixels and covers annotation when panning begins.

screen shot 2017-06-05 at 5 40 51 pm

I followed the tutorial here: and only added the dismissesAutomatically and isAnchoredToAnnotation variables. I tried setting the center of the callout view, but that didn't seem to do anything either. I also asked SO, but still no luck.

@Guardiola31337 Guardiola31337 added the iOS Mapbox Maps SDK for iOS label Jun 9, 2017
@boundsj boundsj added annotations Annotations on iOS and macOS or markers on Android bug labels Jun 9, 2017
@friedbunny
Copy link
Contributor

friedbunny commented Aug 16, 2017

Per the docs for MGLCalloutView.anchoredToAnnotation:

You can adjust the callout view’s precise location by overriding -[UIView setCenter:].

Overriding setCenter: in your custom callout view appears to be necessary, otherwise the callout changes position. You can see an example implementation here.

This seems like something we should try handle automatically in most cases, I don’t know why it was implemented this way.

/cc @frederoni

@frederoni
Copy link
Contributor

My hunch is that the bottom arrow is out of bounds.

Overriding setCenter: for custom callout views should work as intended but bottom center should work by default as long as the frame corresponds to the actual bounds.

@friedbunny
Copy link
Contributor

friedbunny commented Aug 16, 2017

My hunch is that the bottom arrow is out of bounds.

In the callout view example that this issue is based on, the bounds and frame are the same size and the arrow is within them.

mapbox/ios-sdk-examples@5fd1665 has the changes to that example that needed to be made to support “sticky” callouts, happening in mapbox/ios-sdk-examples#108.

@Kayeee
Copy link
Author

Kayeee commented Jul 31, 2018

Just noticed this was still open. Merge #108 fixed it. Thanks!

@Kayeee Kayeee closed this as completed Jul 31, 2018
@vayqerlukashakkarainen
Copy link

This does not seem to be fixed. As soon as I removed the fix, the callout immediately dropped in front of the annotation. Am I missing something that is not displayed in the example? https://docs.mapbox.com/ios/maps/examples/custom-callout/

It's not an issue for me since the fix works well, but still.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
annotations Annotations on iOS and macOS or markers on Android bug iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

No branches or pull requests

6 participants