有谁知道如何在文本框中插入项目符号并进行一些格式化,也许在 iOS 5、XCode 4.3 的 web 视图中(如下面的打印屏幕所示)?

有谁知道如何在文本框中插入项目符号并进行一些格式化,也许在 iOS 5、XCode 4.3 的 web 视图中(如下面的打印屏幕所示)?

对于UITextView手动添加点和换行符,例如:
NSArray *items = [NSArray arrayWithObjects:@"Stack",@"Overflow",nil];
NSMutableString *formattedString = [[NSMutableString alloc] init ];
for (NSString *item in items) [formattedString appendFormat:@"\u2022 %@\n", item];
theTextViewName.text = formattedString;
对于UIWebView创建无序HTML列表,例如:
NSArray *items = [NSArray arrayWithObjects:@"Stack",@"Overflow",nil];
NSMutableString *theSource = [[NSMutableString alloc] init ];
[theSource appendFormat:@"<ul>"];
for (NSString *item in items) [theSource appendFormat:@"<li>%@</li>", item];
[theSource appendFormat:@"</ul>"];
[theWebView loadHTMLString:theSource baseURL:nil];
两者都导致以下列表:
- 堆
- 溢出