Fixed that iOS 14 creates text field often twice, but displays it once -> to focus next text field we have to use nextViewTag + 1

This commit is contained in:
dankito 2020-10-04 22:59:04 +02:00
parent b00a14b3c7
commit 0bfeddeea3
1 changed files with 3 additions and 1 deletions

View File

@ -210,6 +210,8 @@ struct UIKitTextField: UIViewRepresentable {
let nextView = textField.superview?.superview?.superview?.viewWithTag(nextViewTag) let nextView = textField.superview?.superview?.superview?.viewWithTag(nextViewTag)
?? textField.superview?.superview?.superview?.superview?.superview?.viewWithTag(nextViewTag) // for text fields in Lists (tables) ?? textField.superview?.superview?.superview?.superview?.superview?.viewWithTag(nextViewTag) // for text fields in Lists (tables)
?? textField.superview?.superview?.superview?.viewWithTag(nextViewTag + 1) // iOS 14 often creates the same TextField twice but displays it once -> to select next view use nextViewTag + 1
?? textField.superview?.superview?.superview?.superview?.superview?.viewWithTag(nextViewTag + 1)
didHandleReturnKey = nextView?.focus() ?? false didHandleReturnKey = nextView?.focus() ?? false
} }