【发布时间】:2012-07-06 16:13:10
【问题描述】:
有谁知道如何在 iOS 5、XCode 4.3 中插入项目符号并在文本框中进行一些格式化,可能在 web 视图中(如下面的打印屏幕所示)?
【问题讨论】:
标签: ios5 webview formatting xcode4.3
有谁知道如何在 iOS 5、XCode 4.3 中插入项目符号并在文本框中进行一些格式化,可能在 web 视图中(如下面的打印屏幕所示)?
【问题讨论】:
标签: ios5 webview formatting xcode4.3
对于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];
两个结果都进入以下列表:
- 堆栈
- 溢出
【讨论】: