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;
Related
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
in facebook messenger’s chatroom screen, We can scroll up the tableview to slide up keyboard and scroll down the tableview to slide down keyboard. in this situation, the keyboard is following my finger’s scroll action.
I can call the keyboard to show or hide, but i just can listen willShow, didshow, etc.. I can not access keyboard action or animation.
How can I do it?
UIScrollView has a property called keyboardDismissMode that allows you to set different behaviors.
scrollview.keyboardDismissMode = UIScrollViewKeyboardDismissModeInteractive;
Simply you can use-
scrollView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
Short video of what happens when tapping on a textView:
https://www.youtube.com/watch?v=LG_r3iDJKiM
I'm trying to show my custom keyboard on a UITextView from the textViewDidBeginEditing function, The custom keyboard has been tested on UITextFields and is working as intended. Now I'm trying to get the same keyboard to work with UITextViews.
When opening the app for the first time, and tapping on a textView the first time will have this behavior, then when we tap on other textViews the custom keyboard is there directly as intended.
the Current code in my TextViewDidBeginEditing, I tried changing the order of the last 4 lines but with no success:
public func textViewDidBeginEditing(_ textView: UITextView) {
keyboard = Keyboard.sharedInstance.keyboardWithType(availableKeyboards.numbers.rawValue, returnKey:textView.returnKeyType, isSecure: false,decimalSeparator:self.decimalSeparatorCharacter, responderClass: self)
inputView.keyboardAppearance = .dark
inputView.hideAssistantBar()
inputView.inputView = keyboard
inputView.reloadInputViews()
}
This will result in the video above, I tried some other ways but no success yet:
Setting a empty UIView as the inputView, this will still result in the apple keyboard shortly appearing
let view:UIView = UIView()
textView.inputView = view
also tried doing reloadInputViews but that doesn't work either:
textView.reloadInputViews()
also tried running it all on the main tread with
DispatchQueue.main.async { }
but no success, I cannot understand why even setting a UIView() as the inputView will still shortly show the apple keyboard. Any help in the right direction would be greatly appreciated!
Thanks in advance!
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.
I would like to know how to DISABLE (not how to dismiss) the iOS keyboard in a TextView. I don`t even want the keyboard to show up when the user touches the TextView.
All of the examples I found were to make the keyboard disappear AFTER it appears.
The closest thing I got was to set textView.userInteractionEnabled = NO; but that gets rid of the scrolling as well (I want to keep the scrolling).
Thank you in advance!!
Try to implement the following method in text view's delegate:
- (BOOL)textViewShouldBeginEditing:(UITextView *)textView{
return NO;
}