forked from geraldhuard/YFoldView
-
Notifications
You must be signed in to change notification settings - Fork 0
/
YFoldView.h
155 lines (113 loc) · 4.01 KB
/
YFoldView.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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
//
// YFoldView.h
// TalkieWinkie
//
// Created by Gérald HUARD on 20/06/12.
// Copyright (c) 2012 Gérald HUARD. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <QuartzCore/QuartzCore.h>
typedef enum{
yFoldViewBottomToTop,
yFoldViewTopToBottom,
yFoldViewLeftToRight,
yFoldViewRightToLeft
} YFoldViewWay;
@class YFoldView;
@protocol YFoldViewDelegate <NSObject>
@optional
/**
Called when the view ids totally opened
@param foldview : YFoldView Class
@param view : the UIView Object used
@param opened : YES if it's opened
*/
-(void) yfoldview:(YFoldView*)foldview view:(UIView*)view isOpen:(BOOL)opened;
/**
Called when the view is totally closed
@param foldview : YFoldView Class
@param view : the UIView Object used
@param opened : YES if it's opened
*/
-(void) yfoldview:(YFoldView*)foldview view:(UIView*)view isClose:(BOOL)closed;
/**
Called when the height of the view changed
@param foldview : YFoldView Class
@param view : the UIView Object used
@param h : current height of view:w
*/
-(void) yfoldview:(YFoldView*)foldview view:(UIView*)view heightChanged:(CGFloat)h;
/**
Called when the width of the view changed
@param foldview : YFoldView Class
@param view : the UIView Object used
@param w : current width of view:w
*/
-(void) yfoldview:(YFoldView*)foldview view:(UIView*)view widthChanged:(CGFloat)w;
/**
Called when the size (width or height) of the view changed
@param foldview : YFoldView Class
@param view : the UIView Object used
@param size : current size:w
*/
-(void) yfoldview:(YFoldView*)foldview view:(UIView*)view sizeChanged:(CGSize)size;
/**
Called when animation finished
@param foldview : YFoldView Class
@param view : the UIView Object used
@param finished : YES when finished
*/
-(void) yfoldview:(YFoldView*)foldview view:(UIView*)view animFinished:(BOOL)finished;
@end
@interface YFoldView : NSObject{
id<YFoldViewDelegate> _delegate;
BOOL _folded;
YFoldViewWay _way;
NSInteger _tag;
UIView *_view;
CALayer *_main3DLayer;
CGSize _initialSizeView;
CGSize _currentSize;
NSInteger _numberOfFolds;
NSArray *_layerFolds;
NSArray *_shadowLayerFolds;
NSTimer *_timerForAnimation;
int _nbSteps;
int _idxStep;
float _increment;
}
@property (atomic) NSInteger tag;
@property (atomic,assign) id<YFoldViewDelegate> delegate;
@property (atomic,assign) UIView *view;
+(YFoldView*) create:(UIView*)view
numberOfFold:(NSInteger)parts
withWay:(YFoldViewWay)way;
+(YFoldView*)closeView:(UIView*)view
withNumberOfFold:(NSInteger)folds
onWay:(YFoldViewWay)way
duration:(NSTimeInterval)duration
withDelegate:(id<YFoldViewDelegate>)delegate;
+(YFoldView*)closeView:(UIView*)view
withNumberOfFold:(NSInteger)folds
onWay:(YFoldViewWay)way
duration:(NSTimeInterval)duration;
+(YFoldView*)foldView:(UIView*)view
withNbPart:(NSInteger)folds
onWay:(YFoldViewWay)way ;
-(id)initWithView:(UIView*)view
withWay:(YFoldViewWay)way
andNumberOfFolds:(NSInteger)parts;
-(void) horizontalFoldWithHeight:(CGFloat)height;
-(void) animateHorizontalFoldFrom:(CGFloat)heightstart
to:(CGFloat)heightEnd
duration:(NSTimeInterval)duration;
-(void) verticalFoldWithWidth:(CGFloat)width;
-(void) animateVerticalFoldFrom:(CGFloat)widthstart
to:(CGFloat)widthEnd
duration:(NSTimeInterval)duration;
-(void) reset;
-(void) setEndPointPosition:(CGPoint)point;
-(void) closeAnimatedDuration:(NSTimeInterval)duration;
-(void) closeTo:(CGFloat)limit duration:(NSTimeInterval)duration;
-(void) openAnimatedDuration:(NSTimeInterval)duration;
@end