AGSCallout.customView tap events not working with 100.5

765
7
Jump to solution
05-21-2019 06:14 AM
mh10
by
New Contributor III

We have callouts with a customView that has buttons, they are no longer receiving tap events using sdk 100.5. I can see the events in AGSMapView.identifyGraphicsOverlaysAtScreenPoint but they are skipping my view.

Does anyone know of way to get them to function again?

0 Kudos
1 Solution

Accepted Solutions
Nicholas-Furness
Esri Regular Contributor

There was a change made at 100.5 requiring that the custom view provide an intrinsic content size, or have enough constraints to size itself (see the release notes:(

A callout with a custom view now uses AutoLayout to size itself to fit that view. A custom view will need to either provide an intrinsic content size or have enough constraints to define it's size. Previously the size of the view's frame was used to size the callout. For views without an intrinsic content size, that same behavior can still be achieved by adding width and height constraints to the view.

I wonder if that's what's happening here?

View solution in original post

0 Kudos
7 Replies
Nicholas-Furness
Esri Regular Contributor

There was a change made at 100.5 requiring that the custom view provide an intrinsic content size, or have enough constraints to size itself (see the release notes:(

A callout with a custom view now uses AutoLayout to size itself to fit that view. A custom view will need to either provide an intrinsic content size or have enough constraints to define it's size. Previously the size of the view's frame was used to size the callout. For views without an intrinsic content size, that same behavior can still be achieved by adding width and height constraints to the view.

I wonder if that's what's happening here?

View solution in original post

0 Kudos
mh10
by
New Contributor III

It's something related to this I think, I had to fix the view to get them to appear correctly. Everything displays correctly now but can't figure out where the events are going. Its like the parent callout's view is on top of the custom view and is intercepting them?

Nicholas-Furness
Esri Regular Contributor

Hmm. I'll try to reproduce this later today. If you have a simple repro case to share, please DM me.

0 Kudos
Nicholas-Furness
Esri Regular Contributor

Hi. Having tested a bit, I think that must be it. Make sure that your custom view either can unambiguously determine its width and height from constraints, or set a top-level width constraint and height constraint.

See the attached project. It's a simple custom view with a button and some constraints.

If I remove constraints so that the containing view can't size itself properly, then I still see the button but it doesn't capture taps.

0 Kudos
mh10
by
New Contributor III

wow thanks a lot for this, this helps a lot, without constraints is acting exactly like ours.

Our custom views are really ancient so they are going to need more work

0 Kudos
Nicholas-Furness
Esri Regular Contributor

Cool. Glad to help. Whether the views are defined in storyboard, NIB, or code, there should be a quick strategy to get them at least working (maybe you embed your current hierarchy in a top-level view that you set constraints on, for example).

0 Kudos
mh10
by
New Contributor III

Yeah its pretty simple now, I embedded everything in a view with Leading/Top/Trailing/Bottom and height/width constraints.

I started with Leading, Top, height, width and it displayed correctly but had to add Trailing and Bottom to get buttons to work.

thanks again!

0 Kudos