【发布时间】:2016-04-08 13:39:04
【问题描述】:
我正在从 Web 视图中获取字符串并将其显示为 UILabel。我使用以下代码:
NSError *err = nil;
NSAttributedString* convertedString =
[[NSAttributedString alloc]
initWithData: [urlString dataUsingEncoding:NSUTF8StringEncoding]
options: @{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType }
documentAttributes: nil
error: &err];
在上面的代码中,urlString是我的html代码。现在,当我加载它时,如果线条太大,它就会隐藏在框架之外。那么可以在下一行显示吗?
【问题讨论】:
-
[yourLabel setNumberOfLines:0];?这就是你要找的吗? -
没有。当我直接设置字符串时,它可以工作。在上述情况下,它不起作用。
标签: html ios objective-c uilabel nsattributedstring