Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make UITextView not editable and dont want keyboard to showup

In a UITextView have a text which is for readonly and dont want any userinteraction at all means dont want text to be edited and even dont want keyboard to showup. I want to make UITextView scrollable.

Right now what happening is that it is not scrollable and the content is editable and keyboard shows up and bottom wall of the border is not showing. If anyone can help me with this issue. Will appreciate it so much.

Thanks in advance.

like image 880
user1120133 Avatar asked Jan 09 '12 17:01

user1120133


3 Answers

Set the editable / isEditable property to NO / false.

Swift 3, 4:

textView.isEditable = false 

Swift 1, 2:

textView.editable = false 

Objective-C:

textView.editable = NO; 
like image 162
Jason Avatar answered Oct 02 '22 17:10

Jason


textView.editable = NO;

It's mentioned in the documentation.

And about the scrolling; Your UITextView will scroll when the content size exceeds the frame size of your UITextView.

like image 35
Sid Avatar answered Oct 02 '22 16:10

Sid


textview.editable = false // for swift language
textview.selectable = false //

// override textview delegates
func textViewShouldBeginEditing(textView: UITextView) -> Bool {
    return false
}
like image 39
Ikechukwu Henry Odoh Avatar answered Oct 02 '22 17:10

Ikechukwu Henry Odoh