Reputation: 155
Is it possible to change the UILabel text by user interaction? Or is it necessary to do it with a UITextField element?
Can you tell me the way of doing it?
Upvotes: 1
Views: 124
Reputation: 8588
UILabel
is inherently not editable, from the class reference:
The UILabel class implements a read-only text view.
You would have to use a UITextField
or a UITextView
- UITextView
being more like a UILabel
than a UITextField
.
From the UITextView class reference:
The UITextView class implements the behavior for a scrollable, multiline text region. The class supports the display of text using custom style information and also supports text editing. You typically use a text view to display multiple lines of text, such as when displaying the body of a large text document.
Upvotes: 0
Reputation: 428
I don't think that it's possible to change the UILabel text by user interaction.
I would use a UITextField with no borders to make it look like a UILabel. You can do this using the Attributes Inspector in the storyboard.
Upvotes: 1