-
Notifications
You must be signed in to change notification settings - Fork 0
/
TGLStackedViewController.h
executable file
·138 lines (123 loc) · 4.73 KB
/
TGLStackedViewController.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
//
// TGLStackedViewController.h
// TGLStackedViewController
//
// Created by Tim Gleue on 07.04.14.
// Copyright (c) 2014 Tim Gleue ( http://gleue-interactive.com )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
#import "TGLStackedLayout.h"
@interface TGLStackedViewController : UICollectionViewController <UIGestureRecognizerDelegate>
/** The collection view layout object used when all items are collapsed. */
@property (strong, readonly, nonatomic) TGLStackedLayout *stackedLayout;
/** Margins between collection view and items when exposed.
*
* Changes to this property take effect on next
* item being selected, i.e. exposed.
*
* Default value is UIEdgeInsetsMake(40.0, 0.0, 0.0, 0.0)
*/
@property (assign, nonatomic) UIEdgeInsets exposedLayoutMargin;
/** Size of items when exposed if set to value not equal CGSizeZero.
*
* Changes to this property take effect on next
* item being selected, i.e. exposed.
*
* Default value is CGSizeZero
*/
@property (assign, nonatomic) CGSize exposedItemSize;
/** Amount of overlap for items above exposed item.
*
* Changes to this property take effect on next
* item being selected, i.e. exposed.
*
* Default value is 20.0
*/
@property (assign, nonatomic) CGFloat exposedTopOverlap;
/** Amount of overlap for items below exposed item.
*
* Changes to this property take effect on next
* item being selected, i.e. exposed.
*
* Default value is 20.0
*/
@property (assign, nonatomic) CGFloat exposedBottomOverlap;
/** Number of items overlapping below exposed item.
*
* Changes to this property take effect on next
* item being selected, i.e. exposed.
*
* Default value is 1
*/
@property (assign, nonatomic) NSUInteger exposedBottomOverlapCount;
/** Index path of currently exposed item.
*
* The exposed item's selected state is YES.
*
* When user exposes an item this property
* contains the item's index path. The value
* is nil if no item is exposed.
*
* Set this property to a valid item index path
* location to expose it, instead of the current
* one, or set to nil to collapse all items.
*/
@property (strong, nonatomic) NSIndexPath *exposedItemIndexPath;
/** Allow the overlapping parts of unexposed items
* to be tapped and thus select another item.
*
* If set to NO (default), the currently exposed item
* has to be tapped to deselect before another item
* may be selected.
*/
@property (assign, nonatomic) BOOL unexposedItemsAreSelectable;
/** Check whether a given cell can be moved.
*
* Overload this method to prevent items from
* being dragged to another location.
*
* @param indexPath Index path of item to be moved.
*
* @return YES if item can be moved (default); otherwise NO.
*/
- (BOOL)canMoveItemAtIndexPath:(NSIndexPath *)indexPath;
/** Retarget a item's proposed index path while being moved.
*
* Overload this method to modify an item's target location
* while being dragged to another location, e.g. to prevent
* it from being moved to certain locations.
*
* @param sourceIndexPath Moving item's original index path.
* @param proposedDestinationIndexPath The item's proposed index path during move.
*
* @return The item's desired index path. Return proposedDestinationIndexPath if
* it is suitable (default); or nil if item should not be moved.
*/
- (NSIndexPath *)targetIndexPathForMoveFromItemAtIndexPath:(NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath;
/** Move item in data source while dragging.
*
* Overload this method to update the collection
* view's data source.
*
* @param fromIndexPath Original item indexPath
* @param toIndexPath New item indexPath
*/
- (void)moveItemAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath;
@end