iOS 11 UINavigationItem tap events

I have an application that defines custom view for UINavigationItem. This view has tap gesture which presents a popup window when user taps it. Everything worked nicely up until iOS 11. On latest beta (3) gestures arent registered, overlayed button on top of my view isnt sending any actions as well. touchBegin not coming through.


Any ideas?

Replies

Has anyone discovered a solution to this. I'm having the same problem.

I found that if I put a UIButton directly in the titleView, instead of a UIView containing a UIButton, the UIButton receives taps and works. I had to rework my design a bit but that is what I'm doing for now. I couldn't get a UIView or any subviews of one to receive touches when placed in the titleView of the navigationItem.

It seems that with iOS 11 beta 8 the bug has been fixed

Running the full release of iOS 11 and I'm still encountering this issue. None of the workarounds suggested in this StackOverflow question worked or were suitable for my purposes: https://stackoverflow.com/questions/45043946/custom-title-view-as-large-title-in-ios-11-new-navigation-bar

Alex Kosyakov has posted a valid workaround here: https://stackoverflow.com/a/46491487/2398638

It seems because of the new large titles, IOS11 requires the constraints on the custom view in the navigationItem.titleView to be set.

Do this for example:

customView.widthAnchor.constraint(equalToConstant: 200).isActive = true customView.heightAnchor.constraint(equalToConstant: 44).isActive = true self.navigationItem.titleView = customView

Note this must be done for both width and height.

It should work. No need to add a button, at least in my case...