This question is about implementing text indentation ("The placement of text farther to the right to separate it from surrounding text") in iOS.
Take for example the following text:
- This is the first section.
- This is the second one,
with two lines. - This is the third.
Notice that the second row in section 2 begin farther to the right and just below the line above.
My code contains an array of NSString
, each one should be display as a section with numeric bullet like above. for example:
NSArray *array = [NSArray arrayWithObjects:@"1. This is the first section.", @"2. This is the second one, with two lines.", @"3. This is the third.", nil];
I use UILable
to display the text on screen.
To set the text from the array to the label, and to separate each string in a new line I use
myLabel.text = [array componentsJoinedByString:@"\n"];
Any ideas how to get this effect?