Answer the question
In order to leave comments, you need to log in
How to output an indefinite number of lines in iOS?
How to display an indefinite number of lines in iOS (objective c) using a standard or not so UI kit?
Answer the question
In order to leave comments, you need to log in
There is a standard UITextView control, you can make it any size, and throw text to it, and it will add a scroll if necessary. Also don't forget to set the editable property to NO so that it doesn't let you edit the text.
What I don’t like iOS for is the lack of rubber elements and relative values.
You have to write something like this for each UILabel:
[myLabel setNumberOfLines:0];
[myLabel sizeToFit];
There is a method that allows you to calculate the size of a string depending on the font (NSString sizeWithFont). Well, dance from him. Containers will have to be made rubber on their own, i.e. recalculate their sizes when entering text, make animation and so on.
you can use autolayout. make a UILabel, make it at least one constraint per position, then you need to make either a constraint for the width or set a property, I don’t remember exactly. Seems like preferredMaxLayoutWidth. NumberOfLines = 0, and that's it, you can insert large texts
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question