// MARK: - IQKeyboard settings
func setupIQKeyboard()
{
//Enabling keyboard manager
IQKeyboardManager.shared.enable = true
IQKeyboardManager.shared.keyboardDistanceFromTextField = 15
//Enabling autoToolbar behaviour. If It is set to NO. You have to manually create IQToolbar for keyboard.
IQKeyboardManager.shared.enableAutoToolbar = true
IQKeyboardManager.shared.toolbarDoneBarButtonItemText = "Done"
//Setting toolbar behavious to IQAutoToolbarBySubviews. Set it to IQAutoToolbarByTag to manage previous/next according to UITextField's tag property in increasing order.
IQKeyboardManager.shared.toolbarManageBehaviour = .bySubviews
//Resign textField if touched outside of UITextField/UITextView.
IQKeyboardManager.shared.shouldResignOnTouchOutside = true;
//Show TextField placeholder texts on autoToolbar
IQKeyboardManager.shared.shouldShowToolbarPlaceholder = true
IQKeyboardManager.shared.previousNextDisplayMode = .alwaysShow
}
2条答案
按热度按时间h9a6wy2h1#
SWIFT 3.0+解决方案
在AppDelegate中:
UIViewController中
3yhwsihp2#
你可以在SceneDelegate.swift中设置键盘设置,只需添加以下代码即可...