Tiago_Brasil
Tiago_Brasil

Reputation: 121

How to prevent the keyboard from showing (not dismissing) on a TextView?

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!!

Upvotes: 4

Views: 3634

Answers (1)

Vladimir
Vladimir

Reputation: 170849

Try to implement the following method in text view's delegate:

- (BOOL)textViewShouldBeginEditing:(UITextView *)textView{
    return NO;
}

Upvotes: 6

Related Questions