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.
- Recreates the standard iOS badge icon and style.
- Uses Core Animation and Metal to provide VERY efficient layer compositing.
iOS 9.0 and above.
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.
TOBadgeView
is very bare-bones and behaves in what should be a very intuitive manner.
let badgeView = BadgeView() // Create the badge view
badgeView.text = "1"
badgeView.sizeToFit() // Change the badge view size to fit
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.
TOBadgeView is licensed under the MIT License, please see the LICENSE file.