In Storyboard, is it possible to set the maximum number of lines in a UITextView
similar to how you can with a UILabel
? All the other SO posts only show programmatic solutions.
Asked
Active
Viewed 2,530 times
1

Crashalot
- 33,605
- 61
- 269
- 439
-
As per my experience this is not possible. – AskIOS Jan 19 '16 at 06:42
-
2Duplicate:[Limit the number of lines for UITextview](http://stackoverflow.com/questions/5225763/limit-the-number-of-lines-for-uitextview#answer-27793974) – Bista Jan 19 '16 at 06:48
-
Yes it is possible to set number of lines of UItextView like UILabel – yankit Patel Jan 19 '16 at 06:49
-
No it is not. Create an outlet and set it by code. – Ankit Srivastava Jan 19 '16 at 06:51
2 Answers
5
You can do it with User Defined Runtime Attributes
for this view. Select your UITextView
, open Identity inspector, and add new attribute. Enter textContainer.maximumNumberOfLines
to key path
, select Number
as type and put your number to Value
field.

rkyr
- 3,131
- 2
- 23
- 38
-1
First of all make Text as "Attributed" and then select button which is shown in below image..
It may be helpful to you.. Thanks..

yankit Patel
- 331
- 1
- 12
-
How is this helpful? Saying it "may be helpful" is not answering the question. – gioravered Aug 07 '19 at 09:45