这是一套用于显示未读标记的开源库。(一个帮助 UIView 和 UITabBar 显示自定义 badgeView 的库)
包含的类有:
UIView+EBBadgeView:提供扩展方法,使 UIView 可以显示自定义的未读标记。
UITabBar+EBBadgeView:提供扩展方法,使 UITabBar 可以显示自定义的未读标记。
UIView+EBBadgeHelper:提供扩展方法,使 UIView 可以获取所有 subViews 的未读标记,并将所有的 subViews 的未读标记合并。另一个功能是任何 UIView 的标记发生变化都会一层一层向上通知所有的 superView。
EBBadgeModel:标记模型,用于封装标记属性。
将 EBBadgeView 文件夹拖入工程中(drag EBBadgeView dir to your proj)
#import "EBBadgeView.h"
// UIView 显示BadgeView (Just one line code make UIView shows beautiful custom badgeView)
[view eb_showWithBadgeModel:badgeModel];
// 设置BadgeView的位置(set the position)
[view.eb_badgeValueView setCenter:CGPointMake(0,0)];
// UITabBar 显示自定义BadgeView(UITabBar show custom badgeView use following code)
[self.tabBarController.tabBar eb_showWithBadgeModel:badgeModel atIndex:0];
// 在UITabBar中你也可以自己设置BadgeView的位置(You can set the position like this)
[self.tabBarController.tabBar eb_setItemBadgeOffset:CGPointMake(10, 14)];