iOS 11 inputAccessoryView broken

不羁岁月 提交于 2019-12-02 07:31:53

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.

Solved it. It looks like UIToolbar's just are not working correctly in iOS 11.

Changed it to an UIView and removed

self.inputFieldView.isTranslucent = false
self.inputFieldView.setShadowImage(UIImage(), forToolbarPosition: .any)
self.inputFieldView.setBackgroundImage(UIImage(), forToolbarPosition: .any, barMetrics: .default)

got it working (and changed it to a UIView from UIToolbar in the xib as well.)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!