1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- //
- // XYFloatingDragView.h
- // Starbuds
- //
- // Created by 翟玉磊 on 2020/6/29.
- // Copyright © 2020 翟玉磊. All rights reserved.
- // 悬浮窗 因为此功能具有延伸性,增加了类型管理,根据不同的类型添加对应的view
- #import "BaseView.h"
- #import "XYFloatingDragVoiceView.h"
- NS_ASSUME_NONNULL_BEGIN
- typedef enum : NSUInteger {
- XYFloatingDragAutomaticStyleNone, // 默认 无自动吸附边界,停留在最后的可控范围内
- XYFloatingDragAutomaticStyleMargin, // 自动吸附在可控范围边界,(只有实现左右边界吸附)
- XYFloatingDragAutomaticStyleMarginLeft, // 自动吸附在可控范围左边界
- XYFloatingDragAutomaticStyleMarginRight, // 自动吸附在可控范围右边界
- } XYFloatingDragAutomaticStyle;
- typedef enum : NSUInteger {
- XYFloatingDragTypeVoiceChatRoom, // 默认 语音聊天室
- XYFloatingDragTypeVideoChatRoom, // 视频聊天室
- XYFloatingDragTypeLiveRoom, // 直播
- XYFloatingDragType1V1Room, // 1v1视频
- } XYFloatingDragType;
- @protocol XYFloatingDragViewDelegate <NSObject>
- /// 打开悬浮窗
- - (void)openFloatingDragWindow;
- /// 关闭悬浮窗
- - (void)closeFloatingDragWindow;
- @end
- @interface XYFloatingDragView : BaseView
- /// 悬浮按钮的拖拽范围 不设置则默认父view的bounds
- @property (nonatomic, readonly, assign) CGRect cagingArea;
- /// 停留样式 默认 无吸附边界
- @property (nonatomic, readonly, assign) XYFloatingDragAutomaticStyle remainStyle;
- /// 内容类型 默认语音
- @property (nonatomic, readonly, assign) XYFloatingDragType floatingDataType;
- /// 代理
- @property (nonatomic, weak) id<XYFloatingDragViewDelegate>delegate;
- @property (nonatomic, strong) XYFloatingDragVoiceView *voiceView;
- // 根据类型创建悬浮窗 会默认好初始值
- + (instancetype)floatingDragViewWithFloatingDragType:(XYFloatingDragType)type;
- /// 显示view
- - (void)showAnimation:(BOOL)animation;
- /// 隐藏view且销毁view
- - (void)dismissAnimation:(BOOL)animation;
- /// 销毁view
- - (void)clear;
- /// 设置view信息
- - (void)setupViewDataWithModel:(id)model;
- @end
- NS_ASSUME_NONNULL_END
|