TableCells

Latest

  • iPhone devsugar: Simple table badges

    by 
    Erica Sadun
    Erica Sadun
    01.07.2010

    TUAW's devsugar series helps introduce developers to tools and tricks that they might not yet be familiar with. Today's tip centers on table-level badging and how to simply and easily add badged cells to your iPhone Xcode projects. Badges are a natural partner for table view cells. When working with one-to-many data like mailboxes with letters, or RSS feeds with articles, they indicate how many items (or new items) branch off of each available choice. The standard Apple SDK does not offer badge functionality. iPhone Developer Tim Grant Davies to the rescue. He has built an open source github repository for his TDBadgedCell project. Distributed under the Creative Commons Public License, this class allows you to add numbers to the right of each table view cell, and choosing a background color for each number. Each badge is drawn in a custom view using CoreGraphics. This means the class does not rely on extra images stored in memory, and the badges are drawn quickly on demand. You can set color properties for each badge, indicating hues for both the normal and highlighted states.