[英]HTML ordered list in UITextView
我正在嘗試將帶有排序列表的HTML文本設置為UITextView。
NSString *bodyText = "Please follow the below points:<br><ol><li>Point number one.</li><br><li>Point number two.<br><br>Note:<br>There is point to note here.</li><br><li>Point number three.</li></ol>";
NSAttributedString *attributedString = [[NSAttributedString alloc] initWithData:[bodyText dataUsingEncoding:NSUnicodeStringEncoding] options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType} documentAttributes:nil error:nil];
self.bodyTextView.attributedText = attributedString;
上面是HTML文本,我想將其設置為UITextView。 屏幕上的預期結果應該是
Please follow the below points:
1. Point number one.
2. Point number two.
Note:
There is point to note here.
3. Point number three.
但是,我在屏幕上看到的結果是
Please follow the below points:
1. Point number one.
2.
3. Point number two.
Note:
There is point to note here.
4.
5. Point number three.
問題是什么? 我該如何克服? 我不應該更改HTML文本。 我將如何通過應用處理此案?
提前致謝!
您的HTML就是問題。 列表項之間不應有任何<br>
標記。 在列表項內可以,但不要在兩者之間。
刪除兩個不必要的<br>
標記,您的輸出將正確。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.