-
Notifications
You must be signed in to change notification settings - Fork 1
/
SSDropDown.h
161 lines (106 loc) · 3.94 KB
/
SSDropDown.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
156
157
158
159
160
161
//
// SSDropDown.h
//
//
// Created by Shebin Koshy on 4/13/16.
// Copyright © 2016 Shebin Koshy. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef enum
{
kSSDropDownPositionBottom,
kSSDropDownPositionTop,
kSSDropDownPositionLeft,
kSSDropDownPositionRight
} SSDropDownPositions;
@class SSDropDown;
@protocol SSDropDownDelegate <NSObject>
@required
/**
selected an object from drop down view
*/
-(void)dropDown:(nonnull SSDropDown*)dropDownViewObj selectedAnObject:(nullable id)selectedDropDownItem dropDownForTheView:(nonnull UIView*)viewForDropDown;
@optional
/**
register Custom UITableViewCell for Drop down table view
NOTE: should implement when 'needCustomCell = YES'
*/
-(void)dropDown:(nonnull SSDropDown*)dropDownViewObj registerCustomCellForTheDropDownTableView:(nonnull UITableView*)dropDownTableView;
/**
cellForRowAtIndexPath like UITableViewDelegate
NOTE: should implement when 'needCustomCell = YES'
@param selectedObject you should handle the selected item in your custom UITableViewCell
*/
-(nonnull UITableViewCell *)dropDown:(nonnull SSDropDown*)dropDownViewObj dropDownTableView:(nonnull UITableView *)dropDownTableView cellForRowAtIndexPath:(nonnull NSIndexPath *)dropDownIndexPath andSelectedItem:(nullable id)selectedObject;
/**
NOTE: should implement when 'needCustomCell = YES'
heightForRowAtIndexPath for your custom UITableViewCell
*/
- (CGFloat)dropDownTableView:(nonnull UITableView *)dropDownTableView heightForRowAtIndexPath:(nonnull NSIndexPath *)dropDownIndexPath;
/**
While changing orientation, if you need to do something to the drop down view
*/
-(void)dropDown:(nonnull SSDropDown *)dropDownViewObj orientationChanged:(BOOL)isPortrait;
@end
@interface SSDropDown : UIView
/**
If you need to curve edges pass corner Radius
*/
@property (nonatomic) CGFloat cornerRadius;
/**
If you need to adjust the Height of the drop down view
*/
@property (nonatomic) NSInteger dropDownHeight;
/**
to adjust the width of the drop down view
*/
@property (nonatomic) NSInteger dropDownWidth;
/**
to specify the position of the drop down view
*/
@property (nonatomic) SSDropDownPositions dropDownPosition;
/**
if you need to add direction Arrow value should be YES.
NOTE: Drop Down view's width or height will be reduced by arrow size.
*/
@property (nonatomic) BOOL needToShowArrow;
/**
NOTE: You should implement the dropDown delegates 'registerCustomCellForTheDropDownTableView' & 'cellForRowAtIndexPath'
*/
@property (nonatomic) BOOL needCustomCell;
@property (nonatomic) BOOL needAnimation;
/**
array of items to list in dropDown view
NOTE: if you are not using customCell, it will be array of NSString
*/
@property (nonatomic,strong,nonnull) NSArray *arrayItemsToList;
/**
diable super class property
*/
//@property (nonatomic,strong,nullable) UIColor *backgroundColor __attribute__((nouse));
/**
background color of dropDownView
*/
@property (nonatomic,strong,nullable) UIColor *dropDownBackgroundColor;
/**
Drop Down items Listing table view object
*/
@property (nonatomic,strong,nonnull) UITableView *tableViewDropDownList;
/**
If you are using Navigation controller in drop down showing page, pass the navigation controller object
*/
@property (nonatomic,strong,nullable) UINavigationController *navigationController;
/**
delegate
*/
@property (nonatomic,weak,null_unspecified) id <SSDropDownDelegate> delegate;
@property (nonatomic) CGFloat SPECIALCASEBottomCornerRadius;
/**
invoke this method, If you need to show drop down for a UITextField,UIButton or any UIView that placed in UITableViewCell or UICollectionViewCell
*/
-(void)showDropDownForView:(nonnull UIView*)viewForDropDown insideTheCell:(nonnull id)cell withSelectedObject:(nullable id)selectedObject;
/**
invoke this method, if you need to show drop down for a view(superView should be a UIView)
*/
-(void)showDropDownForView:(nonnull UIView*)viewForDropDown withSelectedObject:(nullable id)selectedObject;
@end