####一句demo 显示、点击. 支持自定义
先上图
1、刚刚开始做是用来给测试人员用,不需要一直打包,然后就用一个固定的UIButton来代替.
2、后面有一个分享有礼功能一直悬浮,离开这个页面时移除.然后才考虑写悬浮按钮
3、因为我们产品需求当前页面能手动点击移除,所以用UIView 来写,高度自定义
#####悬浮有2种方式能实现
(1)手势 UIPanGestureRecognizer
UIGestureRecognizerStateBegan
UIGestureRecognizerStateChanged
UIGestureRecognizerStateEnded
(2)点击屏幕的几个方法
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
-(void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
-(void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
手势和点击屏幕事件的区别唯一就是获取当前位置不一样
//点击屏幕事件获取当前位置
UITouch *touch = [touches anyObject];
CGPoint currentPosition = [touch locationInView:self];
// 手势获取当前位置
CGPoint currentPosition = [pan locationInView:self];
下面用手势来一一