Everytime I click UItextview this clipboard would appear on the bottom, how can I disable it programmatically?
Everytime I click UItextview this clipboard would appear on the bottom, how can I disable it programmatically?
On iPhone you could just set autocorrectionType = .no to completely remove that bar above the keyboard.
On iPad however you should first add these extensions:
extension UITextView {
func hideSuggestions() {
// Removes suggestions only
autocorrectionType = .no
//Removes Undo, Redo, Copy & Paste options
removeUndoRedoOptions()
}
}
extension UITextField {
func hideSuggestions() {
// Removes suggestions only
autocorrectionType = .no
//Removes Undo, Redo, Copy & Paste options
removeUndoRedoOptions()
}
}
extension UIResponder {
func removeUndoRedoOptions() {
//Removes Undo, Redo, Copy & Paste options
inputAssistantItem.leadingBarButtonGroups = []
inputAssistantItem.trailingBarButtonGroups = []
}
}
You can disable your textView user interaction:
yourTextView.isUserInteractionEnabled = false
or you can disable textView editability
yourTextView.isEditable = false
UPDATE
If you want to make cursor appears, but do not want this clipboard appears set your textView to become first responder and set your textView inputView with a blank UIView():
textView.becomeFirstResponder()
after that set your textView inputView with a blank UIView():
textView.inputView = UIView()