Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iphone bullet point list

Is there any way to make a bullet point list in iphone?

If you copy and paste a bullet point list into a UITextView in IB then it shows up. Is there anyway to do this programatically?

Thank you

Tom

like image 736
Thomas Clayson Avatar asked Sep 26 '10 17:09

Thomas Clayson


People also ask

Can you add bullet points in apple Notes?

You can also create bullets manually. To start a bulleted list simply type an asterisk followed by a space.

How do I get rid of bullet points on my iPhone?

Instead, Apple's hidden it. Select your bulleted or numbered list, and choose that Format > Indentation > Decrease item, and it disappears!

How do you insert a bulleted list?

Place your cursor where you want a bulleted list. Click Home> Paragraph, and then click the arrow next to Bullets. Choose a bullet style and start typing.


1 Answers

The "bullet" character is at Unicode code point U+2022. You can use it in a string with @"\u2022" or [NSString stringWithFormat:@"%C", 0x2022].

The "line feed" character is at Unicode code point U+000A, and is used as UIKit's newline character. You can use it in a string with @"\n".

For example, if you had an array of strings, you could make a bulleted list with something like this:

NSArray * items = ...;
NSMutableString * bulletList = [NSMutableString stringWithCapacity:items.count*30];
for (NSString * s in items)
{
  [bulletList appendFormat:@"\u2022 %@\n", s];
}
textView.text = bulletList;

It won't indent lines like a "proper" word processor. "Bad things" will happen if your list items include newline characters (but what did you expect?).

(Apple doesn't guarantee that "\uXXXX" escapes work in NSString literals, but in practice they do if you use Apple's compiler.)

like image 86
tc. Avatar answered Oct 09 '22 03:10

tc.