-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathUIView+DragDrop.h
58 lines (40 loc) · 1.26 KB
/
UIView+DragDrop.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
// UIView+DragDrop.h
//
// Created by Ryan Meisters.
//
#import <UIKit/UIKit.h>
typedef NS_ENUM( NSInteger, UIViewDragDropMode) {
UIViewDragDropModeNormal,
UIViewDragDropModeRestrictY,
UIViewDragDropModeRestrictX
};
@protocol UIViewDragDropDelegate;
/**
* A Category that adds Drag and drop functionality to UIView
*/
@interface UIView (DragDrop)
/**
* Set up drag+drop
* @params
* views: NSArray of drop views
* delegate: id delegate conforming to UIViewDragDropDelegave protocol
*/
- (void) makeDraggableWithDropViews:(NSArray *)views delegate:(id<UIViewDragDropDelegate>)delegate;
- (void) makeDraggable;
- (void) setDelegate:(id<UIViewDragDropDelegate>)delegate;
- (void) setDragMode:(UIViewDragDropMode)mode;
- (void) setDropViews:(NSArray*)views;
@end
/**
* The UIViewDragDropDelegate Protocol
*/
@protocol UIViewDragDropDelegate <NSObject>
- (void) view:(UIView *)view wasDroppedOnDropView:(UIView *)drop;
@optional
- (BOOL) viewShouldReturnToStartingPosition:(UIView*)view;
- (void) draggingDidBeginForView:(UIView*)view;
- (void) draggingDidEndWithoutDropForView:(UIView*)view;
- (void) view:(UIView *)view didHoverOverDropView:(UIView *)dropView;
- (void) view:(UIView *)view didUnhoverOverDropView:(UIView *)dropView;
@end