I have the following set up for my UIToolBar / Accessory View on a view controller
@IBOutlet var inputFieldView: UIToolbar!
override var canBecomeFirstResponder: Bool{
return true
}
override var inputAccessoryView: UIView?{
return self.inputFieldView
}
then inside my viewDidLoad I have:
let seperator = UIView(frame: CGRect(x:0 , y: 0, width: ScreenSize.width(), height: 1))
seperator.backgroundColor = UIColor.lightBackground
self.inputFieldView.addSubview(seperator)
self.inputFieldView.isTranslucent = false
self.inputFieldView.setShadowImage(UIImage(), forToolbarPosition: .any)
self.inputFieldView.setBackgroundImage(UIImage(), forToolbarPosition: .any, barMetrics: .default)
self.inputFieldView.removeFromSuperview()
This worked great for ios versions 10 and 9. It is a text view with a "Send" button. It sits at the bottom of the screen and when pressed, becomes first responder allowing the keyboard to come up and it positions itself correctly.
With ios 11 i cannot even click on it when it is at the bottom, so I cannot type at all.
Solved it. It looks like UIToolbar's just are not working correctly in iOS 11.
Changed it to an UIView and removed
got it working (and changed it to a UIView from UIToolbar in the xib as well.)
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:
Hopefully this will get fixed on the next major version.