Select to view content in your preferred language

Callout Position

288
2
Jump to solution
10-02-2024 11:10 AM
RTC
by
Emerging Contributor

In SDK 100, the Callout would auto scroll the map if it was going to render outside the map view to prevent it from being cut off. Is this no longer a feature in SDK 200.5.1?

1 Solution

Accepted Solutions
Nicholas-Furness
Esri Regular Contributor

Hello @RTC, thanks for the question.

That's correct. There are some differences between callout behavior in the 100.x iOS SDK and the 200.x Swift SDK. There was a lot of logic in the callout leader code in 100.x that on balance we decided we could forego for 200.x. That does result in a simpler callout experience.

For example, in the Swift SDK the callout is always centered over the leader point.

One option could be to center the map over the tapped GeoElement and show the callout, and then restore the map extent when the callout is dismissed. Of course, that imparts a particular user experience on your app, so may not be ideal.

Or, since every callout is now a custom view, you could of course be more precise about how much you pan the map to only bring the callout onto the display. GeometryReader can help work out the size of the SwiftUI view that is your callout content and along with ScreenToLocation() could help you know how much to pan the map to ensure the callout is on-screen.

If those options won't help, I'd like to learn more about your use cases. Feel free to DM me if you prefer.

View solution in original post

2 Replies
Nicholas-Furness
Esri Regular Contributor

Hello @RTC, thanks for the question.

That's correct. There are some differences between callout behavior in the 100.x iOS SDK and the 200.x Swift SDK. There was a lot of logic in the callout leader code in 100.x that on balance we decided we could forego for 200.x. That does result in a simpler callout experience.

For example, in the Swift SDK the callout is always centered over the leader point.

One option could be to center the map over the tapped GeoElement and show the callout, and then restore the map extent when the callout is dismissed. Of course, that imparts a particular user experience on your app, so may not be ideal.

Or, since every callout is now a custom view, you could of course be more precise about how much you pan the map to only bring the callout onto the display. GeometryReader can help work out the size of the SwiftUI view that is your callout content and along with ScreenToLocation() could help you know how much to pan the map to ensure the callout is on-screen.

If those options won't help, I'd like to learn more about your use cases. Feel free to DM me if you prefer.

RTC
by
Emerging Contributor

Hi Nick, thanks for the reply.

Yes, quite a bit has changes with callouts so I just wanted to be sure that I wasn't missing something. I will work building a function to control the position of the callout using your suggestions. Thanks!