2222
2323#import " RMXCellButton.h"
2424#import " RMXCellColorList.h"
25+ #import " RMXCellColorPicker.h"
2526#import " RMXCellSegmented.h"
2627#import " RMXCellSlider.h"
2728#import " RMXCellStepper.h"
2829#import " RMXCellSwitch.h"
29- #import " RMXCellColorPicker .h"
30+ #import " RMXCellTextInput .h"
3031#import " RMXCellTextPicker.h"
3132#import " RMXOverlayNavigationBar.h"
3233#import " RMXOverlayView.h"
4041@interface RMXOverlayViewController () <UITableViewDataSource,
4142 UITableViewDelegate,
4243 UIGestureRecognizerDelegate,
43- RMXOverlayViewDelegate>
44+ RMXOverlayViewDelegate,
45+ RMXCellDelegate>
4446@property (nonatomic , strong ) RMXOverlayView *view;
4547@end
4648
@@ -64,6 +66,7 @@ - (void)viewDidLoad {
6466
6567 self.view .tableView .dataSource = self;
6668 self.view .tableView .delegate = self;
69+ self.view .tableView .keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
6770
6871 [self .view.tableView registerClass: [RMXCellButton class ]
6972 forCellReuseIdentifier: NSStringFromClass ([RMXCellButton class ])];
@@ -81,6 +84,8 @@ - (void)viewDidLoad {
8184 forCellReuseIdentifier: NSStringFromClass ([RMXCellSwitch class ])];
8285 [self .view.tableView registerClass: [RMXCellTextPicker class ]
8386 forCellReuseIdentifier: NSStringFromClass ([RMXCellTextPicker class ])];
87+ [self .view.tableView registerClass: [RMXCellTextInput class ]
88+ forCellReuseIdentifier: NSStringFromClass ([RMXCellTextInput class ])];
8489
8590 UINavigationItem *item = self.view .navigationBar .topItem ;
8691 [(UIButton *)item.leftBarButtonItem.customView addTarget: self
@@ -200,10 +205,11 @@ - (void)maximizePanel {
200205}
201206
202207- (void )dismissOverlay : (id )sender {
203- [self dismissOptionsViewWithCompletion :nil ];
208+ [self dismissOverlayWithCompletion :nil ];
204209}
205210
206- - (void )dismissOptionsViewWithCompletion : (void (^)(BOOL finished))completion {
211+ - (void )dismissOverlayWithCompletion : (void (^)(BOOL finished))completion {
212+ [self .view endEditing: YES ];
207213 [UIView animateWithDuration: 0.2
208214 animations: ^{
209215 [self .view hidePanel ];
@@ -226,7 +232,7 @@ - (void)sendEmailInvite:(id)sender {
226232 [RMXRemixer sendEmailInvite ];
227233}
228234
229- #pragma mark - < UITableViewDataSource>
235+ #pragma mark - UITableViewDataSource
230236
231237- (NSInteger )tableView : (UITableView *)tableView numberOfRowsInSection : (NSInteger )section {
232238 return [_content count ];
@@ -238,15 +244,18 @@ - (UITableViewCell *)tableView:(UITableView *)tableView
238244 NSString *identifier = [self cellIdentifierForVariable: variable];
239245 RMXCell *cell = (RMXCell *)[tableView dequeueReusableCellWithIdentifier: identifier];
240246 cell.variable = variable;
247+ cell.delegate = self;
241248 return cell;
242249}
243250
251+ #pragma mark - UITableViewDelegate
252+
244253- (CGFloat)tableView : (UITableView *)tableView heightForRowAtIndexPath : (NSIndexPath *)indexPath {
245254 RMXVariable *variable = _content[indexPath.row];
246255 return [[self cellClassForVariable: variable] cellHeight ];
247256}
248257
249- #pragma mark - < RMXOverlayViewDelegate>
258+ #pragma mark - RMXOverlayViewDelegate
250259
251260- (void )touchStartedAtPoint : (CGPoint)point withEvent : (UIEvent *)event {
252261 // No-op.
@@ -256,6 +265,12 @@ - (BOOL)shouldCapturePointOutsidePanel:(CGPoint)point {
256265 return self.presentedViewController != nil ;
257266}
258267
268+ #pragma mark - RMXCellDelegate
269+
270+ - (void )cellRequestedFullScreenOverlay : (RMXCell *)cell {
271+ [self maximizePanel ];
272+ }
273+
259274#pragma mark - Private
260275
261276- (Class )cellClassForVariable : (RMXVariable *)variable {
@@ -275,6 +290,8 @@ - (Class)cellClassForVariable:(RMXVariable *)variable {
275290 return [RMXCellSwitch class ];
276291 } else if (variable.controlType == RMXControlTypeTextPicker) {
277292 return [RMXCellTextPicker class ];
293+ } else if (variable.controlType == RMXControlTypeTextInput) {
294+ return [RMXCellTextInput class ];
278295 }
279296 return nil ;
280297}
0 commit comments