I implemented an own inputAccessoryView within a VC that gets pushed by a UINavigationController
.
This is how the VC looks like: Notice the inputAccessoryView at the bottom (the white bar with the button and a text field)
When I swipe from the left to the right of the screen (in order to dismiss the current VC and go back), the inputAccessoryView moves down and disappears. In addition, if I stop the swipe gesture anywhere and let the current VC jump back (so that it won't be dismissed), the inputAccessoryView also moves down and disappears.
I attached another photo while moving:
An another one after the VC jumped back:
As you can see, the inputAccessoryView has disappeared.
My piece of code:
private final lazy var inputContainerView: UIView = {
let containerView = UIView()
containerView.frame = CGRect(x: 0, y: 0, width: self.view.frame.width, height: 50)
[...]
return containerView
}()
[...]
override var inputAccessoryView: UIView? {
return inputContainerView
}
override var canBecomeFirstResponder: Bool {
return true
}
You may want to try calling
self.becomeFirstResponder()
in viewWillAppear
or viewDidAppear
both of them will be trigged when that happens.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With