UIButton in the navigation bar Does not recognize cranes in iOS 11

I have a UIButtonnavigation bar that is on top of UIImageand UILabel. It worked great in iOS 10, but now in iOS 11 it doesn't recognize the taps from my outlet @IBAction.

navbar button

I tried moving the faucet's outlet to the panel button element, but that didn't work either. UIButtonhas the following limitations:

enter image description here

I confirmed that he was there, giving him a green background, so I know that this is visible and accessible.

Any idea what is going on?

+4
source share
3 answers

I found a solution from another developer.

, . View .

:

1

@IBOutlet View , .

@IBOutlet weak var myView: UIView!

2

viewDidLoad() :

myView.widthAnchor.constraint(equalToConstant: 63).isActive = true
myView.heightAnchor.constraint(equalToConstant: 33).isActive = true

, .

+8

, : NavBar NavBarItems ( rigth ) : UITapGestureRecognizer ( ):

let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard))
view.addGestureRecognizer(tap)

iOS 10.3 - ... 11 - ""... , TapGestureRecognizer - NavBar ...

, - - ...

,

+1

Clifton Labrum, . Apple iOS 11. Storyboard, .

UIBarButtonItem . , :

UIButton has its limitations

UIButton Limitations

- .

This should eliminate all the strange behavior caused by iOS 11.

0
source

Source: https://habr.com/ru/post/1685974/


All Articles