How to resize callout

1621
5
Jump to solution
11-13-2019 05:42 AM
DevendraKhatri
New Contributor III

How do I resize the callout height based on the content it includes. 

In Android, I could use callout.refresh() that resizes the callout based on the lines I have in my text view. In iOS SDK I don't see similar method.

suggestions pls

0 Kudos
1 Solution

Accepted Solutions
Nicholas-Furness
Esri Regular Contributor

Hey Todd.

Yes. We apply a max width constraint. It's not supposed to be there when using a custom view, but it seems we have a bug. We'll get that fixed, but in the meantime you could set AGSCallout.autoAdjustWidth to false before you set your custom view:

mapView.callout.autoAdjustWidth = false
mapView.callout.customView = myCustomView‍‍

Sorry about that. Hope this info helps!

View solution in original post

5 Replies
Nicholas-Furness
Esri Regular Contributor

I assume you're using a custom UIView for this with the AGSCallout.customView property.

The callout should resize according to its contents. Just make sure that you're resizing the UITextView appropriately. This Stack Overflow thread might help.

0 Kudos
ToddAtkins
Occasional Contributor

Is there a maximum width for the callout? I've been fiddling with this as well and can get the the size to change but the width at least seems to have an upper bound of around 290 or so.

Edit to add: I can set the custom view to a width of say 300 or 400 but the callout just clips it. Setting height to 300 or 400 expands the callout as expected.

0 Kudos
Nicholas-Furness
Esri Regular Contributor

Hey Todd.

Yes. We apply a max width constraint. It's not supposed to be there when using a custom view, but it seems we have a bug. We'll get that fixed, but in the meantime you could set AGSCallout.autoAdjustWidth to false before you set your custom view:

mapView.callout.autoAdjustWidth = false
mapView.callout.customView = myCustomView‍‍

Sorry about that. Hope this info helps!

ToddAtkins
Occasional Contributor

Cool, thanks. Works perfectly now.

DevendraKhatri
New Contributor III

Thanks a lot ! It helped...

0 Kudos