I have created a custom inputView for my UITextField. The view itself looks and functions great, but on the iPad I'm getting undo, redo, and paste buttons above my custom inputView. How do I remove those buttons? They don't have any functionality, but they should be removed.
With Swift 3 and XCode 8 I was able to remove the bar by removing the two button groups on the text field input:
self.textField.inputAssistantItem.leadingBarButtonGroups.removeAll()
self.textField.inputAssistantItem.trailingBarButtonGroups.removeAll()
// hide undo, redo, paste button bar for textfield input view
UITextInputAssistantItem* item = [your_textfield inputAssistantItem];
item.leadingBarButtonGroups = #[];
item.trailingBarButtonGroups = #[];
will hide the top bar for input view.
Reference:How to hide the shortcut bar in iOS9
Try removing the inputAccessoryView:
self.textField.inputAccessoryView = nil;
Related
I am developing a custom keyboard extension app, but apple keyboard native autocorrection and suggestion does not function with my app. The native autocorrection and suggestion bar is empty and appears persistently above my custom keyboard. I am trying to hide it to create my own with my suggestion list.
The problem is I did not find the way to hide the native suggestion bar.
UITextInputAssistantItem *item = [textInput.textInputView inputAssistantItem];
item.leadingBarButtonGroups = #[];
item.trailingBarButtonGroups = #[];
does not work because my custom keyboard does not use a textInput. My custom keyboard works with external text input fields like for example Safari search field using self.textDocumentProxy
Also
self.inputAssistantItem.leadingBarButtonGroups = #[];
self.inputAssistantItem.trailingBarButtonGroups = #[];
does not work.
Any help?
Thank you.
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
Have ViewController with SearchBar.
After click search button appears SearchBar with focus
How to hide 2 segmented controls "Title"?
Alternate to Jeff's answer
If this code segmentedControl.hidden = YES; is not working.. Then Embed the segment control inside UIView and hide that view like this,
view.hidden = YES;
You need to hide the UISegmentedControl, as a UIView subclass it has a hidden property.
segmentedControl.hidden = YES;
I am adding Swift 3 solution so that it will be useful for others. In Swift 3, you can hide UISegmentedControl like this
segmentedControl.isHidden = true
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];
How to hide/disable keyboard ,if the textview editing is enabled.
I only want to that user can only be able to select the text and can't be allowed for entering text.
Because selected text will be converted in to image for move animation.
User will not be allowed for entering any text in textview so that's why keyboard should be hidden or disable ,he will be allowed only for text selection.
uitextview.editable = NO; or set checkmark in IB. It will allow to select text with options - Copy and Select All without keyboard appearing. Tap on the word and hold to select text.
ok just uncheck the behavior of you UItextview in .xib file.
Something to try it the 'editable' setting doesn't work out is to create a UIView that's hidden and out of the way somewhere and assign it as the inputView for the text view. If that property is non-nil, the view it contains will be shown instead of the keyboard.
Such as:
self.textView.inputView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 1, 1)] autorelease];
try this
yourtextview.UserinterationEnable=No;
This will make the keyboard disappear:
[[[UIApplication sharedApplication] keyWindow] endEditing:YES];
This what you want to do?