Jay*_*dip 12 ios swift iqkeyboardmanager
我是ios的新手,我在iqkeyboardmanager上工作,我想在IQKeyboardManager中访问Done按钮动作.
Lal*_*mar 19
您可以处理完成,下一个和上一个按钮的点击
[textField.keyboardToolbar.previousBarButton setTarget:self action:@selector(previousAction:)];
[textField.keyboardToolbar.nextBarButton setTarget:self action:@selector(nextAction:)];
[textField.keyboardToolbar.doneBarButton setTarget:self action:@selector(doneAction:)];
Run Code Online (Sandbox Code Playgroud)
在快速:
customField.keyboardToolbar.doneBarButton.setTarget(self, action: #selector(doneButtonClicked))
func doneButtonClicked(_ sender: Any) {
//your code when clicked on done
}
Run Code Online (Sandbox Code Playgroud)
Poo*_*kie 15
你可以使用UITextViewDelegate
func textFieldDidEndEditing(_ textField: UITextField) {
}
Run Code Online (Sandbox Code Playgroud)
你可以导入
导入IQKeyboardManager
在所需的文件中,之后
vc1Textfield.addDoneOnKeyboard(withTarget:self,action:#selector(doneButtonClicked))
这里vc1Textfield是我的textfield和doneButtonClicked定义如下:
@objc func doneButtonClicked(_ sender:Any){}
希望有人帮助!!! 快乐编码....
我将尝试以更方便的方式进行描述:
import IQKeyboardManagerSwift
class EditPostViewCell: UITableViewCell {
@IBOutlet weak var commentTextView: UITextView!
override func awakeFromNib() {
IQKeyboardManager.shared.toolbarDoneBarButtonItemText = "Send Comment"
commentTextView.delegate = self
}
@objc func didPressOnDoneButton() {
commentTextView.resignFirstResponder()
sendComment()
}
}
extension EditPostViewCell: UITextViewDelegate {
public func textViewDidBeginEditing(_ textView: UITextView) {
let invocation = IQInvocation(self, #selector(didPressOnDoneButton))
textView.keyboardToolbar.doneBarButton.invocation = invocation
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9765 次 |
| 最近记录: |