Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode : UITextfield uneditable

Is ther a way to make a UItextfield uneditable ?

like image 409
Sacha Avatar asked Mar 13 '11 16:03

Sacha


People also ask

How do you make a text field not editable in Swift?

How do you make a text field Uneditable in Swift? Within code: textfield. enable = false.

Can you disable editing of a text field?

editing is a readonly property. You can't set it. If it's a UITextView, it has an editable property which you can set to false. Save this answer.

How do I make text selectable in SwiftUI?

Swift's Text views represent static, unselectable text by default, but you can change that using the . textSelection() modifier with the . enabled value. When text is selected, the user automatically gains access to the regular text actions such as Copy and Share.

How do I dismiss a keyboard in SwiftUI?

Pure SwiftUI (iOS 15) To dismiss the keyboard, simply set view's focusedField to nil . The return key will dismiss keyboard automatically (since iOS 14).


2 Answers

[theTextField setEnabled: NO];
like image 123
Matthias Bauch Avatar answered Oct 02 '22 15:10

Matthias Bauch


Set the userInteractionEnabled property to NO.

like image 41
mvds Avatar answered Oct 02 '22 15:10

mvds