最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】iOS中attributedText和普通的text有何区别

iOS crifan 3446浏览 0评论

uitableview – Swift: Auto layout and table view cells with dynamic heights – Stack Overflow

-》

preferredMaxLayoutWidth – UILabel Class Reference

-》

要搞清楚:

attributedText和普通的text有何区别

 

尤其是:

ios – Swift change color of text using NSMutableAttributedStrings – Stack Overflow

中的:

cell.textLabel?.text

cell.textLabel?.attributedText

 

搜:

Swift UITableView attributedText

Swift(2.0)中NSAttributedString[简译]

 

-》

感觉是:

  • text:就是普通的文字
  • attributedText:带属性的文字-》带特殊的那种,字体,下划线,删除线,阴影等等特殊效果的,文字

 

而对于:

UITableViewCell中textLabel中的text和attributedText:

text:如果是普通的文字,那么直接设置text为文字的值即可

-》另外还有textColor,font等参数可以去设置文字的其他的基本属性

-》如果需要特殊定义的,特殊的显示效果的,比如删除线,下划线等等文字,那么就去:

实现对应的带属性的attributedText,设置好,然后赋值给cell.textLabel?.attributedText

转载请注明:在路上 » 【已解决】iOS中attributedText和普通的text有何区别

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
83 queries in 0.163 seconds, using 22.07MB memory