Latest 1.2.8
Homepage https://github.com/ChaselAn/ACBadge
License MIT
Platforms ios 8.0, requires ARC
Authors

Swift3.0版本的右上角未读红点

安装

CocoaPods

pod 'ACBadge'

Then, run the following command:

$ pod install

使用

设置全局属性

ACBadge.default.redDotWidth = 20
ACBadge.default.backgroundColor = UIColor.red
ACBadge.default.textColor = UIColor.white
ACBadge.default.font = UIFont.systemFont(ofSize: 15)
ACBadge.default.maximumNumber = 99 // 数字红点的最大值,超过这个值,显示“这个值+”

为UIView添加红点

view.ac_showBadge(with: .redDot)
// 或者 view.ac_showRedDot(true)
view.ac_showBadge(with: .number(with: 999)) // number传0时消失
view.ac_clearBadge() // 清除红点

为UITabBarItem添加红点

let firstItem = tabBarController?.tabBar.items?.first
firstItem.ac_showBadge(with: .redDot)
// 或者 firstItem.ac_showRedDot(true)
firstItem.ac_showBadge(with: .number(with: 999)) // number传0时红点消失
firstItem.ac_clearBadge() // 清除红点

Latest podspec

{
    "name": "ACBadge",
    "version": "1.2.8",
    "summary": "Swift3.0u7248u672au8bfbu7ea2u70b9",
    "homepage": "https://github.com/ChaselAn/ACBadge",
    "license": "MIT",
    "authors": {
        "ChaselAn": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/ChaselAn/ACBadge.git",
        "tag": "1.2.8"
    },
    "source_files": "ACBadge/*.swift",
    "requires_arc": true,
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This