M
M
MagoVinch2014-01-15 10:13:49
Objective-C
MagoVinch, 2014-01-15 10:13:49

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

4 answer(s)
A
Alexander, 2014-01-15
@MagoVinch

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.

A
Alexey, 2014-01-15
@Alexious_sh

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];

G
gleb_kudr, 2014-01-15
@gleb_kudr

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.

A
Alexey Storozhev, 2014-01-16
@storoj

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 question

Ask a Question

731 491 924 answers to any question