iOS 11 inputAccessoryView broken

后端 未结 2 461
眼角桃花
眼角桃花 2021-01-28 05:06

I have the following set up for my UIToolBar / Accessory View on a view controller

@IBOutlet var inputFieldView: UIToolbar!
override var canBecomeFirstResponder:         


        
2条回答
  •  生来不讨喜
    2021-01-28 05:47

    This is a known bug on iOS 11. UIToolbar subviews don't get the touch events because some internal views to the toolbar aren't properly setup.

    The current workaround is to call toolBar.layoutIfNeeded() right before adding subviews.

    In your case:

    inputFieldView.layoutIfNeeded()
    

    Hopefully this will get fixed on the next major version.

提交回复
热议问题