1

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

IQKeyboardManager有什么可以整合的线索customTextfield吗?

4

1 回答 1

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
    }
}
于 2017-06-06T21:23:37.227 回答