0

This is an oddly specific question, but I can't seem to figure it out or find an answer. I have a banner that hangs off of a navigation bar (visible by sliding constraints when volume is low). I want to make this banner tappable, either by button or gesture recognizer, both don't seem to work, and the map is still being controlled below it when tapping

The banner in question '

I've tried:

  • setting isExclusiveTouch = true on the bannerView
  • bringing that bannerView to top of that navigationView (bringSubViewToFront)
  • setting the BannerView at the bottom in interfaceBuilder

Not sure what else to do. Sorry if it's unclear, I can add more code examples if needed.

kevlar924
  • 55
  • 1
  • 1
  • 6

1 Answers1

0

After searching for a while I found the answer. I had to override the hitTest function of the parent UIView. I had to do this because in order to 'show' the bannerView I was updating constraints to slide it down (outside of it's parent view). Since it was outside of it's parent View's constraints the banner was ignoring user input.

Code examples for obj-c and swift can be found here:

Capturing touches on a subview outside the frame of its superview using hitTest:withEvent:

kevlar924
  • 55
  • 1
  • 1
  • 6