气泡通知的实现

RKNotificationHub是一个可以让UIView简单实现气泡的三方库

687474703a2f2f692e696d6775722e636f6d2f537045324251762e676966.gif

常用属性

//创建一个气泡
- (id)initWithView:(UIView *)view;
- (id)initWithBarButtonItem:(UIBarButtonItem *)barButtonItem;

//%%% adjustment methods
// 气泡初始条数
- (void)setView:(UIView *)view andCount:(NSUInteger)startCount;
 // 设置气泡的尺寸
- (void)setCircleAtFrame:(CGRect)frame;
//  设置气泡颜色,和通知个数的颜色
- (void)setCircleColor:(UIColor*)circleColor labelColor:(UIColor*)labelColor;
// 移动气泡的指定位置
- (void)moveCircleByX:(CGFloat)x Y:(CGFloat)y;
// 设置缩放比例,中心点不变
- (void)scaleCircleSizeBy:(CGFloat)scale;
// 设置气泡提示文字的字体
@property (nonatomic, strong) UIFont *countLabelFont;

下面是设置气泡提示数目的

//%%% changing the count
// 增加一条
- (void)increment;
// 增加N条
- (void)incrementBy:(NSUInteger)amount;
// 删除一条
- (void)decrement;
// 增加N条
- (void)decrementBy:(NSUInteger)amount;
// 当前条数
@property (nonatomic, assign) NSUInteger count;

设置状态


//%%% hiding / showing the count
- (void)hideCount;
- (void)showCount;

设置动画类型

//%%% animations
- (void)pop;  // 弹出
- (void)blink; // 眨眼
- (void)bump; // 跳动

由于比较简单,Demo就不写了,可以指定任何UIView的提示,默认显示右上角

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 发现 关注 消息 iOS 第三方库、插件、知名博客总结 作者大灰狼的小绵羊哥哥关注 2017.06.26 09:4...
    肇东周阅读 14,816评论 4 61
  • github排名https://github.com/trending,github搜索:https://gith...
    小米君的demo阅读 10,310评论 2 38
  • 从周末开始王宝强离婚的微博就一直霸占的微博屏幕,太多的人在关注着这件事,大部分人都在骂马蓉。我也很同情王宝强...
    李家四爷阅读 1,540评论 0 0
  • 听到动静,栗酥从厨房里探出头来,看了一眼苏筱的表情,心里安定了几分:谢天谢地,还好没有生气。 明明是色香味俱全的一...
    风眠花未歇阅读 1,810评论 0 1

友情链接更多精彩内容