Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create numbers with rounded background in UITableViewCell (like the email app)?

In the email app, on the overview page, you can see a summary of the number of new emails you have in your accounts. Does anyone know how to create the numbers on the rounded background?

email summary

like image 371
Justin Kredible Avatar asked Dec 08 '10 20:12

Justin Kredible


2 Answers

It's not a built-in cell style but should be pretty easy to mimic.

Add a UILabel to the cell set its font, textColor and backgroundColor. To get the rounded corners, play with label.layer.cornerRadius.

like image 87
Ole Begemann Avatar answered Nov 20 '22 15:11

Ole Begemann


If you read this post on TUAW, you can get more infos about your problem...
http://www.tuaw.com/2010/01/07/iphone-devsugar-simple-table-badges/

Tim Grant Davies created an open source project to do what you want and it is available under CC License on github... You can download it here: https://github.com/tmdvs/TDBadgedCell

Hope this can help you :)

like image 36
matteodv Avatar answered Nov 20 '22 14:11

matteodv