TOBadgeView 1.0.0

TOBadgeView 1.0.0

Maintained by Tim Oliver.



  • By
  • Tim Oliver

TOBadgeView

CocoaPods Version GitHub license Platform PayPal

TOBadgeView is a very basic UIView subclass to provide a GPU-efficient recreation of the class iOS badge icon.

It is wholly dynamic, where all sizing, fonts and colors can be changed, and it can intelligently resize itself to fit a particular text value.

Features

  • Recreates the standard iOS badge icon and style.
  • Uses Core Animation and Metal to provide VERY efficient layer compositing.

System Requirements

iOS 9.0 and above.

Installation

As a CocoaPods Dependency

Add the following to your Podfile:

pod 'TOBadgeView'

Manual Installation

Copy the folder TOBadgeView to your Xcode project.

TOBadgeView is an Objective-C project, but it has been written to work properly in Swift as well. If you are using it in a Swift project, don't forget to include it in your Objective-C bridging header.

Examples

TOBadgeView is very bare-bones and behaves in what should be a very intuitive manner.

Hello World Example

let badgeView = BadgeView() // Create the badge view
badgeView.text = "1"
badgeView.sizeToFit() // Change the badge view size to fit

Credits

TOBadgeView was originally created by Tim Oliver as a component for iComics, a comic reader app for iOS.

iOS Device mockups used in the screenshot created by Pixeden.

License

TOBadgeView is licensed under the MIT License, please see the LICENSE file. analytics