Files
2025-11-14 14:07:04 +08:00

78 lines
2.3 KiB
Objective-C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// WMDragView.h
// WMDragView
//
// Created by zhengwenming on 2016/12/16.
//
//
#import <UIKit/UIKit.h>
// 拖曳view的方向
typedef NS_ENUM(NSInteger, WMDragDirection) {
WMDragDirectionAny, /**< 任意方向 */
WMDragDirectionHorizontal, /**< 水平方向 */
WMDragDirectionVertical, /**< 垂直方向 */
};
@interface WMDragView : UIView
/**
是不是能拖曳默认为YES
YES能拖曳
NO不能拖曳
*/
@property (nonatomic,assign) BOOL dragEnable;
/**
活动范围默认为父视图的frame范围内因为拖出父视图后无法点击也没意义
如果设置了,则会在给定的范围内活动
如果没设置,则会在父视图范围内活动
注意设置的frame不要大于父视图范围
注意设置的frame为0000表示活动的范围为默认的父视图frame如果想要不能活动请设置dragEnable这个属性为NO
*/
@property (nonatomic,assign) CGRect freeRect;
/**
拖曳的方向默认为any任意方向
*/
@property (nonatomic,assign) WMDragDirection dragDirection;
/**
contentView内部懒加载的一个UIImageView
开发者也可以自定义控件添加到本view中
注意最好不要同时使用内部的imageView和button
*/
@property (nonatomic,strong) UIImageView *imageView;
/**
contentView内部懒加载的一个UIButton
开发者也可以自定义控件添加到本view中
注意最好不要同时使用内部的imageView和button
*/
@property (nonatomic,strong) UIButton *button;
/**
是不是总保持在父视图边界默认为NO,没有黏贴边界效果
isKeepBounds = YES它将自动黏贴边界而且是最近的边界
isKeepBounds = NO 它将不会黏贴在边界它是free(自由)状态跟随手指到任意位置但是也不可以拖出给定的范围frame
*/
@property (nonatomic,assign) BOOL isKeepBounds;
/**
点击的回调block
*/
@property (nonatomic,copy) void(^clickDragViewBlock)(WMDragView *dragView);
/**
开始拖动的回调block
*/
@property (nonatomic,copy) void(^beginDragBlock)(WMDragView *dragView);
/**
拖动中的回调block
*/
@property (nonatomic,copy) void(^duringDragBlock)(WMDragView *dragView);
/**
结束拖动的回调block
*/
@property (nonatomic,copy) void(^endDragBlock)(WMDragView *dragView);
@end