Closed cs-joao-souza closed 7 years ago
I'm not sure why it's not working but I believe this code should be enough to add custom actions
When you use the method addPreviousNextDoneOnKeyboardWithTarget you create a new IQToolbar and when its done the general configuration isnt used. So i need to add the new actions and intercept after this method using inputAccessoryView and change what i need.
I think that the general configuration must being taken. What do you say?
You can create your own UIToolbar and add your own bar buttons and add to your toolbar and you can then assign your textfield.inputAccessoryView = toolbar. Hope this will work.
I'm using this configurations
IQKeyboardManager.sharedManager().overrideKeyboardAppearance = true IQKeyboardManager.sharedManager().keyboardAppearance = .dark IQKeyboardManager.sharedManager().keyboardDistanceFromTextField = 50 IQKeyboardManager.sharedManager().toolbarDoneBarButtonItemText = "OK" IQKeyboardManager.sharedManager().shouldToolbarUsesTextFieldTintColor = false IQKeyboardManager.sharedManager().toolbarTintColor = .white IQKeyboardManager.sharedManager().enable = true
And this
let previousSelector = #selector(CreditCardDataDataSource.textFieldCardNumberPreviousAction(barButtonItem:)) let nextSelector = #selector(CreditCardDataDataSource.textFieldCardNumberNextAction(barButtonItem:)) let doneSelector = #selector(CreditCardDataDataSource.textFieldCardNumberDoneAction(barButtonItem:)) textField?.addPreviousNextDoneOnKeyboardWithTarget(self, previousAction: previousSelector, nextAction: nextSelector, doneAction: doneSelector) textField?.setEnablePrevious(false, isNextEnabled: true)
And i'm with a problem that my toolbar is not being customized in this ViewController that i use custom actions for previous, next and done.
How can i solve this?