How to hide keyboard suggestion view in keyboard? - ios

How to hide keyboard suggestion view in keyboard?
I Tried following methods but they don't working.
amountTextField.textContentType = UITextContentType(rawValue: "") and amountTextField.autocorrectionType = .no

Related

Programmatically Hide Keyboard Shortcut Bar iOS 13

I am trying to programmatically remove the keyboard shortcut bar that appears at the bottom of an iPad when an external keyboard is connected.
There are plenty of posts and answers with "solutions" to this, but none of them work with the latest iOS. The closest solution was such:
UITextInputAssistantItem* item = [self inputAssistantItem];
item.leadingBarButtonGroups = #[];
item.trailingBarButtonGroups = #[];
All this currently does is remove the buttons on the left side of the bar. And this does nothing also:
textField.autocorrectionType = UITextAutocorrectionTypeNo;
How can I "programmatically" remove this bar??
Sorry for using swift code.
You can try my idea:
change autocorrectionType of UITextField from .yes to no.
Get inputAssistantItem and change leadingBarButtonGroups and trailingBarButtonGroups to empty.
Source code example:
tfSearchNameHiragana.autocorrectionType = .no
let shortcut: UITextInputAssistantItem? = tfSearchNameHiragana.inputAssistantItem
shortcut?.leadingBarButtonGroups = []
shortcut?.trailingBarButtonGroups = []
Following the existing answers didn't do the job for me (iPadOS 14.7.1). Instead of hiding the toolbar, I've got an empty (therefore useless) grey bar sitting on top of my onscreen keyboard, hiding valuable screen real estate, especially on an landscape home-buttoned iPad model.
I found out, that additionally to setting the two empty arrays you need to set the inputAccessoryView to nil. Et voilĂ ! The bar above the keyboard completely disappears.
textField.inputAssistantItem.leadingBarButtonGroups = []
textField.inputAssistantItem.trailingBarButtonGroups = []
textField.inputAccessoryView = nil
You may think that setting the view to nil alone does the job, but as it turned out, this works only in combination with setting the empty arrays.
From InterfaceBuilder, change Correction to No:
Or, from source:
item.autocorrectionType = .no

dismiss keyboard in textview while scroll

I am new to IOS i tried lot but still i am failed while scrolling when user touches any of the textview keyboard appear return not working.
screenshot for my output screen:
You can dismiss keyboard with dismiss on drag option on Tableview .
scrollView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
scrollView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;

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.
Try this,
YourTextField.autocorrectionType = UITextAutocorrectionTypeNo;
If your project is using IQKeyboardManager, then to get rid of that top bar, you can use IQKeyboardManager.shared().disabledToolbarClasses.add(YourViewController.self)
remove inputAccessoryView from your UITextField
yourTextField.inputAccessoryview = nil

UITextView doesn't switch input toolbar to custom keyboard

iOS9 Xcode7 beta6: I'm trying to switch between keyboards (custom/default) for UITextView by using reloadInputViews(). Changing UIKeyboardType and UIKeyboardAppearance by calling reloadInputViews() works perfectly. Also following code works well under iOS8.
This implies that textView is already a first responder:
private func showCustomKeyboard() {
textView.inputView = customKeyboardView
textView.reloadInputViews()
}
private func showDefaultKeyboard() {
textView.inputView = nil
textView.reloadInputViews()
}
Things like the following have made no effect and also they look like overkill:
textView.inputView.resignFirstResponder()
textView.inputView.becomeFirstResponder()
textView.inputView = customKeyboardView
textView.reloadInputViews()
I found a couple of related questions on SO but no one of them doesn't have to do with iOS9 and as I said before it does work in iOS8.
Have anyone come across this bug?
Did you try to change the order? Because you dismiss and after that show a keyboard again. Does it make sense?:
textView?.inputView.resignFirstResponder() // dismiss keyboard
textView?.inputView.becomeFirstResponder() // show keyboard
textView?.inputView = customKeyboardView // reassign new keyboard
textView?.reloadInputViews() // reload keyboard
Try:
textView?.inputView.resignFirstResponder() // dismiss keyboard
textView?.inputView = customKeyboardView // reassign new keyboard
textView?.reloadInputViews() // reload keyboard
textView?.inputView.becomeFirstResponder() // show keyboard
The bug was related to a simulator with iOS9 on the board and eventually has been fixed with unchecking Keyboard -> Connect -> Hardware Keyboard.

How to disable keyboard when clicking a UITextField in iOS?

I am currently developing a prototype that I want to do user testing on desktop first before loading to iPad.
I am looking for solutions to disable the keyboard after clicking a textfield. That means after clicking a textfield, user is able to enter information from the macbook keyboard directly, and the virtual keyboard that automatically shows up in the simulator will not appear. I have been through a lot of tutorials but they are all dismissing the keyboard after user entry; that is not what I am looking for. How should I hide the keyboard?
Thanks so much!
Use this:
UIView *dummyView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
myTextField.inputView = dummyView; // Hide keyboard, but show blinking cursor
It works for UITextField and UITextView and they need to be set to editable.
What you did Here:
You created a dummy view of width=hight=0, & assigned it as the inputView of your textField.
How It works:
Instead of showing default, keyboard, now, the viewController is showing DummyView as inputView for your UITextField. As DummyView has Width=height=0, You will not see anything on the screen :)
Here is another answer which I found the same hack but with little additional supportive code snippet to hide the blinking cursor too.
-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
return NO; // Hides both keyboard and blinking cursor.
}
I needed this to be done for a Quantity text field where I increase/decrease the quantity using a UIStepper view. So I needed the keyboard to be hidden always.
This will set the inputView of your textField to, basically, an empty UIView with no frame.
self.theTextField.inputView = [[UIView alloc] initWithFrame:CGRectZero];

Resources