ios - IQKeyboardManagerSwift pod install : How to implement Done button action in swift -
i'm using following library (which helps manage multiple textfields)
pod 'iqkeyboardmanagerswift', '~> 4.0'
my question how got implement done button action
in our viewcontroller ? refer link.
in iquiview+iqkeyboardtoolbar.swift file method available.
public func adddoneonkeyboardwithtarget(_ target : anyobject?, action : selector) { adddoneonkeyboardwithtarget(target, action: action, titletext: nil) }
but don't understand how implement in swift code. please me..
you can call on textfield object. example
[textfield1 adddoneonkeyboardwithtarget:@selector(doneaction:)]; /*! doneaction. */ -(void)doneaction:(uibarbuttonitem*)barbutton { //doneaction }
swift version:
textfield1.adddoneonkeyboardwithtarget(self, action: #selector(self.doneaction(_:)), shouldshowplaceholder: true) func doneaction(_ sender : uitextfield!) { self.view.endediting(true) }
Comments
Post a Comment