作者lsyjim (Jim)
看板MacDev
标题[问题] UILabel 显示 html 的问题
时间Fri Jan 2 12:27:21 2015
请教各位一下,iOS 7.0.3用UILabel显示html字串是否有问题?
我是用NSAttributedString 将html语法转译过後,再宣告一个UILabel
用attributedText属性去存
可是最後的结果,iOS 7.0.3的模拟器跟实机跑出来都会显示不完全
iOS 7.1之後的都可以正常显示
如图显示:
iOS 7.0.3
http://imgur.com/rbmo2Gq
iOS 7.1
http://imgur.com/4G6ZLjg
html跟转译後的文字
http://imgur.com/D6Kcj0u
请问有什麽解决方案吗?
另外我那些内文是用UITableView 的Cell去塞Label显示的
但cell的高度有什麽比较好的算法吗...?
thx
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 122.118.69.186
※ 文章网址: http://webptt.com/cn.aspx?n=bbs/MacDev/M.1420172844.A.A5A.html
1F:→ uranusjr: 我觉得只是你 UILabel 没 resize 好让上面被截掉了吧... 01/02 13:55
2F:→ uranusjr: 用 -sizeToFit 或其他方法根据内容调整尺寸试试 01/02 13:56
3F:推 howdiun: sizeThatFit可以算出高度 01/06 09:13