解决方案对于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
}
}
确实启用了该VC的iqkeyboard经理? – dip
我之前没有使用过'SkyFloatingLabelTextField',但是您是否启用了'IQKeyboardManager'呢? – chengsam
已经启用'IQKeyboardManage'r,我将'two textfield'放入uiview,iPad横向方向,'keyboard'在单击第一个文本框时覆盖uitextfield。有没有办法做自定义uitextfield? –