1

我正在使用SkyFloatingLabelTextField这是一个自定义UITextField。将IQKeyboardManager添加到我的Podfile(pod install)之后,预计它会自动处理键盘问题。使用Swift 3自定义文本字段(SkyFloatingLabelTextField)的IQKeyboardManager 3

任何线索IQKeyboardManagercustomTextfield

+0

确实启用了该VC的iqkeyboard经理? – dip

+0

我之前没有使用过'SkyFloatingLabelTextField',但是您是否启用了'IQKeyboardManager'呢? – chengsam

+0

已经启用'IQKeyboardManage'r,我将'two textfield'放入uiview,iPad横向方向,'keyboard'在单击第一个文本框时覆盖uitextfield。有没有办法做自定义uitextfield? –

回答

1

解决方案对于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 
    } 
} 
相关问题