Search code examples
iosswiftiqkeyboardmanager

How to Handle IQKeyboardManager Done button action in toolbar?


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


Solution

  • 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
    }