swift - How do I display strings from an array vertically stacked? -


i trying take each string in array , list them in label 1 string per line. tried using joined method /n attempt make got next line literally puts /n in between each string. i'm sorry if happens duplicate unless i'm wording question wrong cant seem find answer. example of i'm looking for.

string[0]  string[1]  string[2] , on... 

try this:

let array = ["the", "quick", "brown", "fox"]     let string = array.joined(separator: "\n") 

joined returns new string concatenating elements of sequence, adding given separator (in case, line break) between each element in array.

that return this:

the quick brown fox 

...and set yourlabel.numberoflines = 0

from apple's documentation:

the default value numberoflines 1. remove maximum limit, , use many lines needed, set value of numberoflines 0.


Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -