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?
Solved! Go to Solution.
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?
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?
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?
Hmm. I'll try to reproduce this later today. If you have a simple repro case to share, please DM me.
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.
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
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).
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!