Search code examples
uibuttonuibarbuttonitemios11xcode9beta6

UIBarButtonItem not clickable on iOS 11 beta 7?


There is another question on SO about this but this has nothing to do with it because I think this has to do with a beta version of iOS 11.

I have these 2 UIButtons that are grouped inside a UIView. This UIView is put inside a UIBarButtonItem and the whole thing is set as Left Bar Button Items, using Interface Builder.

Each button, when clicked, show a popover, triggered by storyboard.

I am testing this on an iPad 3, running iOS 9, using Xcode 8. This works wonderfully.

Now I have decided to test this on my iPad Pro 9.7" that is running iOS 11 beta 7. I am using Xcode 9 beta 6. When I run this on the iPad Pro, all buttons on the navigation bar are dead. They don't respond to clicks. Now I try the same Xcode 9 beta 6 and run the app on the iPad 3 with iOS 9 and again, all work wonderfully.

I am compiling for iOS 9.1.

Buttons not even highlight to acknowledge the tap, as they do on iOS 9.

Is there an issue with iOS 11 beta 7 and bar button items?

Any ideas?


Solution

  • I have discovered the problem! Amazing bug!

    This is the drill. I was adding two buttons to the left navigation item by doing this:

    1. create a view
    2. add two UIButtons inside that view.
    3. add that view to the left navigation item.

    This was compiled for iOS 9 and works on a device with iOS 10 and below but not iOS 11.

    The "correct" way of doing this is this

    1. Drag an UIButton to the left navigation item.
    2. Drag another UIButton to the left navigation item.

    You will see that iOS allows that to happen and will manage both buttons under "navigation items".

    this will work on all iOS versions I have tested from 9 thru 11.