How to Handle IQKeyboardManager Done button action in toolbar?

Jaydip picture Jaydip · Oct 26, 2017 · Viewed 18.8k times · Source

I am new in ios I work on iqkeyboardmanager and I want to access Done button action in IQKeyboardManager.

Answer

Lalit Kumar picture Lalit Kumar · Jan 10, 2018

You can handle clicks of done, next and previous button

[textField.keyboardToolbar.previousBarButton setTarget:self action:@selector(previousAction:)];
[textField.keyboardToolbar.nextBarButton setTarget:self action:@selector(nextAction:)];
[textField.keyboardToolbar.doneBarButton setTarget:self action:@selector(doneAction:)];

In swift:

customField.keyboardToolbar.doneBarButton.setTarget(self, action: #selector(doneButtonClicked))

func doneButtonClicked(_ sender: Any) {
        //your code when clicked on done
}