Search code examples
iosswiftuistoryboardiqkeyboardmanager

iOS: how to change the order of UITextField to be focused using IQKeyboardManager


I have placed multiple UITextFields into an UIViewController in the storyboard.
I am using IQKeyboardManager to scroll the UITextFields over the keyboard when they are focused.

IQKeyboardManager toolbar

When I click the next button in the keyboard toolbar, another UITextField is getting focused while the current one loses focus.

How can I control the order of the focus of the UITextFields by the keyboard toolbar buttons?


Solution

  • After hours of research, I found that the focusing order of UITextFields depends on the order of the XML nodes in the storyboard file.

    The order of the XML nodes of <code>UITextField</code>s

    As a result I changed this order and everything works fine as I wanted.