Closed gorbat-o closed 7 years ago
@gorbat-o
Before I provide how I was able to handle this, I want to express that it sounds like "bad" UX. Hopefully the question is vague and you don't mean for every single time they tap "next", but only for certain fields. Disclaimer, I didn't try other methods, but below does indeed work.
class SampleFormController: FormViewController {
// you need to override this function because navigationAction is defined
// in an extension, Swift doesn't allow overriding those yet
override func inputAccessoryView(for row: BaseRow) -> UIView? {
let r = super.inputAccessoryView(for: row)
// you need to replace the #selector defined in FormViewController
navigationAccessoryView.nextButton.action = #selector(newNavigationAction(_:))
return r
}
func newNavigationAction(_ sender: UIBarButtonItem) {
// we have to repeat the stock code because we can't access the navigationAction
// method, otherwise a Thread exception will be thrown
let direction: Direction = sender == navigationAccessoryView.previousButton ? .up : .down
navigateTo(direction: direction)
// you may not want to call navigateTo if Next was tapped, depends on your needs
if direction == .down {
tableView?.endEditing(true)
}
}
}
Hi,
Eureka: 1.7.0 (because of swift 2.3) Xcode: Lastest Issues: Already search with reading a lot of issues, but found nothing which helping me :/ iOS: 9.3 & 10
i just want to hide keyboard on next button of keyboard, this one
for dismiss i was testing with
l've tried to add this on cellSelection of the next row, but it's changing nothing.
Thanks :)
EDIT1: i tested all of this :