In ViewController I've added InputButton. I have custom class for picking value from input view.
class InputButton: UIButton {
var customInputView: UIView = UIView()
var customInputAccessoryView: UIView = UIView()
override var inputView: UIView {
get { return self.customInputView }
set { self.customInputView = newValue }
}
override var inputAccessoryView: UIView {
get { return self.customInputAccessoryView }
set { self.customInputAccessoryView = newValue }
}
override var canBecomeFirstResponder: Bool {
return self.isEnabled
}
}
After I tap the button, I perform (in ViewController):
self.currencyButton.inputView = self.currenciesPicker
self.currencyButton.inputAccessoryView = self.doneToolbar
self.currencyButton.becomeFirstResponder()
doneToolbar is custom UIToolbar with set
private lazy var spaceItem: UIBarButtonItem = {
let item: UIBarButtonItem = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)
return item
}()
private lazy var doneItem: UIBarButtonItem = {
let item: UIBarButtonItem = UIBarButtonItem(customView: self.doneButton)
return item
}()
...
self.barStyle = UIBarStyle.default
self.items = [
self.spaceItem,
self.doneItem
]
Size is set manually but I also tried to set it with different way.
I don't know why on iOS 13 inputAccessoryView is not visible but on iOS 12 it displays properly
In debug view hierarchy inputAccessoryView looks just fine