RKNotificationHub 2.0.5

RKNotificationHub 2.0.5

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布时间最后发布2017年11月

Richard Kim 维护。




RKNotificationHub

为 UIView(iOS6及以上版本)快速添加一个通知图标的方法。支持更多帮助

demo

代码

  RKNotificationHub* hub = [[RKNotificationHub alloc]initWithView:yourView]; // sets the count to 0
  [hub increment]; // increments the count to 1, making the notification visible

Pod

    pod 'RKNotificationHub'

使用方法

increment

  [hub increment];
  -(void)increment;
  -(void)incrementBy:(int)amount;
  -(void)decrement;
  -(void)decrementBy:(int)amount;
  @property (nonatomic, assign) int count; //%%% set to a certain number

组合动作!

blink

  [hub increment];
  [hub pop];

自定义

blink

  //%%% COLOR
  [hub setCircleColor:[UIColor colorWithRed:0.98 green:0.66 blue:0.2 alpha:1]
           labelColor:[UIColor whiteColor]];

frame

  //%%% CIRCLE FRAME
  [hub setCircleAtFrame:CGRectMake(-10, -10, 30, 30)]; //frame relative to the view you set it to

  //%%% MOVE FRAME
  [hub moveCircleByX:-5 Y:5]; // moves the circle 5 pixels left and down from its current position

  //%%% CIRCLE SIZE
  [hub scaleCircleSizeBy:2]; // doubles the size of the circle, keeps the same center

blank

  //%%% BLANK BADGE
  [hub hideCount];
  /* shoutout to imkevinxu for this suggestion */

故障排除

通知没有显示出来!

  • 如果中心值为 < 1,圆形将隐藏。尝试调用 [increment]
  • 确保您设置的视图是可见的(例如,您是否调用了 [self.view addSubview: yourView]?)
  • 确保您没有在任何地方调用 [hideCount]。请使用 [showCount] 进行补偿

增加/减少不当!

  • 我已将其编写为任何计数值 < 1 都不会显示。如果您需要帮助自定义此功能,请与我联系

圆形位置不正常

  • 如果您想调整圆形的大小,请使用 [scaleCircleSizeBy:]。0.5 将获得一半大小,2 将获得双倍大小
  • 如果圆形只偏移了几像素,请使用 [moveCircleByX: Y:]。这将根据给定的像素数移动圆形
  • 如果您想手动设置圆形,请调用 [setCircleAtFrame:] 并提供您自己的 CGRect

其他事情不正常

  • 请给我发一条推文@cwRichardKim 并使用 #RKNotificationHub,以便其他人也能搜索这些问题
  • 请使用右侧的 GitHub 问题报告器
  • 请给我发一封电子邮件[email protected](可能需要几天时间)

更新

  • 1.0.0 第一个包含 cocoa pod 的版本
  • 1.0.1 cocoa pod 允许 iOS 7.0
  • 1.0.2 添加了 "hideCount","showCount" 和 "count" 方法,允许不显示数字的不确定徽章
  • 1.0.5 为更大的数字添加了气泡扩展 (gif)
  • 2.0.0 将计数值更改为 NSUInteger(删除了对负数的支持),将局部常量定义为 static const
  • 2.0.1 iOS 6 兼容性
  • 2.0.2 将计数值改回 'int' 以更好地与 Swift 兼容
  • 2.0.4 修复了 cocoa pod 更新问题

改进/参与的领域

  • 添加自定义动画的机制
  • 单例选项