Reputation: 2488
I made this UITextView and everything is perfect except the fact that when the user taps it, the keyboard opens up. How can I disable that "editing(?)" option?
Here's the code:
- (void)loadAboutStable {
UITextView *aboutStable = [[UITextView alloc] init];
[aboutStable setText:@"Please check Your network connection"];
[self addSubview:aboutStable];}
Upvotes: 27
Views: 34903
Reputation: 25938
You can do it with XIB too by UnCheck of the editable checkbox as given in below screen :
and also do it by code :
textViewObject.editable = false
Upvotes: 7
Reputation: 987
to really destroy any interactivity ;)
descriptionText.isSelectable = false;
descriptionText.isEditable = false;
Upvotes: 0
Reputation: 242
In Swift 2.0 it has to be false not NO.
theClues.selectable = false
I had a problem with making my clues appear in white letters unless I checked the selectable button on the storyboard for the textview. However, leaving "Selectable" checked and adding the line above works.
Upvotes: 0
Reputation: 635
yourTextView.editable = NO;
It will make your text View not editable. It can be called from anywhere if you have made the property of you text view in .h file like this
@property (nonatomic, strong) UITextView *youTextView;
Upvotes: 4
Reputation: 1094
SWIFT 2.0 & XCODE 7.0 example for solution provided by @James Webster
Upvotes: 1
Reputation: 41
Select the UITextView in the storyboard
Choose the Property Inspector and under the Behavior section uncheck "Editable"
----Xcode version 5.0
Upvotes: 4
Reputation: 32066
[aboutStable setUserInteractionEnabled:NO]
should do it
and if you still need scrolling:
aboutStable.editable = NO;
Upvotes: 69