使用键盘开始键入时,我正在使用IQKeyboardManger库滚动文本字段,但是我不想显示其库中的默认工具栏。以下是我使用的代码。

override func viewDidLoad() {
        super.viewDidLoad()

        self.chatTextField.inputAccessoryView = [[UIView alloc] init];  //This will remove toolbar which have done button.

        self.chatTextField.keyboardDistanceFromTextField = 8; //This will modify default distance between textField and keyboard. For exact value, please manually check how far your textField from the bottom of the page. Mine was 8pt.

    }

ios - 如何在IQKeyboardManager iOS Swift 3中隐藏工具栏-LMLPHP

最佳答案

您可以在属性下面设置IQKeyboardManager。

我假设您已经在应用委托(delegate)的didFinishLaunch中启用了IQKeyboardManager,如下所示

    IQKeyboardManager.sharedManager().enable = true

shouldShowTextFieldPlaceholder to false ==>如果要隐藏占位符工具栏部分

应该隐藏到false ==>上的下一个 =如果要隐藏下一个和上一个按钮等。

您可以在 App的 didFinishLaunch 中启用设置像这样删除
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.

    IQKeyboardManager.sharedManager().enable = true

    IQKeyboardManager.sharedManager().enableAutoToolbar = false
    IQKeyboardManager.sharedManager().shouldShowTextFieldPlaceholder = false
    IQKeyboardManager.sharedManager().shouldHidePreviousNext = false


    return true
}

关于ios - 如何在IQKeyboardManager iOS Swift 3中隐藏工具栏,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/40124364/

10-11 04:28
查看更多