我正在使用SkyFloatingLabelTextField
这是一个自定义的UITextField
. 添加IQKeyboardManager
到我的 Podfile ( pod install
) 后,预计它将自动处理键盘问题。
IQKeyboardManager
有什么可以整合的线索customTextfield
吗?
我正在使用SkyFloatingLabelTextField
这是一个自定义的UITextField
. 添加IQKeyboardManager
到我的 Podfile ( pod install
) 后,预计它将自动处理键盘问题。
IQKeyboardManager
有什么可以整合的线索customTextfield
吗?
SWIFT 3.0+ 解决方案
在 AppDelegate 中:
// Enable IQKeyboardManager for customization
IQKeyboardManager.sharedManager().enable = true
在 UIViewController
class A : UIViewController
viewDidLoad() {
customizeKeyboard()
}
func customizeKeyboard(){
IQKeyboardManager.sharedManager().shouldResignOnTouchOutside = true
IQKeyboardManager.sharedManager().shouldShowTextFieldPlaceholder = false
IQKeyboardManager.sharedManager().toolbarDoneBarButtonItemText = ""
IQKeyboardManager.sharedManager().shouldHidePreviousNext = true
IQKeyboardManager.sharedManager().keyboardDistanceFromTextField = 150
emailTextField.delegate = self
passwordTextField.delegate = self
// to remove the autocorrect on top of keyboard
emailTextField.autocorrectionType = .no
emailTextField.keyboardType = .emailAddress
// to remove the IQManager view on top of Keyboard
let emptyUIView = UIView()
emailTextField.inputAccessoryView = emptyUIView
passwordTextField.inputAccessoryView = emptyUIView
forgotEmailTextField.inputAccessoryView = emptyUIView
}
}