I'm creating one long string from a number of strings in an array like this:
oneString = @"First Line\n";
for (int i = 0; i < itemsToAdd.count; i ++){
oneString = [NSString stringWithFormat:@"%@ %@\n", oneString, stringToAdd];
}
This all works great until stringToAdd
is long enough to wrap. If you notice the spaces between %@ %@
, this is acting as an indentation. Most of the strings I'm adding don't wrap, but I'm trying to figure out a way to add spaces before each line after the first.
The reason I'm building up this one long string is to calculate the height of it in order to adjust the size of a tableViewCell
based on the length of this string. itemsToAdd
is a variable size array. Sometimes it will be one line, sometimes it will be 15+ items.
This is sample output:
First Line
Item 1 is good
Item 2 is fine
Item 3 is long and it wraps so
it goes like this and it sucks
Item 4 is fine