简体   繁体   中英

How i hide a top keyboard bar in iOS 9

I'm a beginner ios developer. I'm trying hide "shortcut keyboard bar" on iOS keyboard with unsuccessful. Bellow is my code:

- (void)textFieldDidBeginEditing:(UITextField*)textField {
      UITextInputAssistantItem* item = [textField inputAssistantItem];
      item.leadingBarButtonGroups = @[];
      item.trailingBarButtonGroups = @[];
}

I did hide the assistant bar buttons with setting autocorretionType, but the top bar with action button (ok, done, ...) don't hide.

在此处输入图片说明

Can someone help me out? Tks.

如果您的项目使用IQKeyboardManager ,那么要摆脱顶部栏,您可以使用IQKeyboardManager.shared().disabledToolbarClasses.add(YourViewController.self)

试试这个,

YourTextField.autocorrectionType = UITextAutocorrectionTypeNo;

从您的UITextField删除inputAccessoryView

yourTextField.inputAccessoryview = nil

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM