悬浮球 / 悬浮按钮 / 辅助按钮

类似于 iOS 系统自带的 AssistiveTouch / 京东 / 聚划算 / 建行等的辅助按钮 —— 由 anticipate_91分享

FloatingBall

Function Description

这是一个类似于iOS系统自带的AssistiveTouch/京东《我的》部分的悬浮按钮等类型的辅助按钮,具体处理逻辑同AssistiveTouch 

 

How to use

使用起来比较方便,只需导入 JhtFloatingBall.h 头文件即可  

(1) 简单的初始化

JhtFloatingBall *fb = [[JhtFloatingBall alloc] init];
UIImage *suspendedBallImage = [UIImage imageNamed:@"SuspendedBall"];
fb.frame = CGRectMake(0, 20, suspendedBallImage.size.width*0.65, suspendedBallImage.size.height*0.65);
fb.image = suspendedBallImage;
[self.view addSubview:fb];

(2) 设置悬浮球停留的方式 

// 停留方式
typedef NS_ENUM(NSInteger, StayMode) {
    // 四周均可停靠(优先考虑左右两侧,具体处理逻辑同AssistiveTouch)
    stayMode_Around = 0,
    // 只能停靠左右两侧
    stayMode_OnlyLeftAndRight = 1
};
/** 悬浮球停留的方式
 *  default:StayMode_Around(优先考虑左右两侧,具体处理逻辑同AssistiveTouch)
 */
@property (nonatomic, assign) StayMode stayMode;

(3) 设置悬浮球停留时的透明度 

/** 悬浮球停留时的透明度(stayAlpha >= 0,1:不透明)
 *  default:不透明
 */
@property (nonatomic, assign) CGFloat stayAlpha;
  • 注:创建成功后,可以根据自己的需求添加相应的事件

Remind

  • ARC
  • iOS >= 8.0
  • iPhone \ iPad

Hope

  • If you find bug when used,Hope you can Issues me,Thank you or try to download the latest code of this framework to see the BUG has been fixed or not
  • If you find the function is not enough when used,Hope you can Issues me,I very much to add more useful function to this framework ,Thank you !
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值