开发者

UITableView create a badge on the right of every cell

开发者 https://www.devze.com 2023-04-02 09:14 出处:网络
I want to create a table view like this one with a badge on the right. Can someone suggest me how can I do to get开发者_开发百科 this result?

UITableView create a badge on the right of every cell

I want to create a table view like this one with a badge on the right. Can someone suggest me how can I do to get开发者_开发百科 this result? thanks


I'm using greate open source project TDBadgedCell from Tim Davies for that purposes. It is very simple to use and configure.

Get it here: https://github.com/tmdvs/TDBadgedCell


AFAIK, this is not available by default. You have to customize your cell.

  • Create a UILabel.
  • Set textAlignment as UITextAlignmentCenter.
  • Change its cornerRadius.
  • Add a drop shadow using shadowColor, shadowOffset(a positive offest) ,etc.,
  • Set label's text.
  • Resize label's width to fit the text.
  • Set it as cell's accessoryView.
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号