-
Notifications
You must be signed in to change notification settings - Fork 0
/
CQFormCell.m
53 lines (44 loc) · 1017 Bytes
/
CQFormCell.m
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
/*
Copyright (C) 2016 Quentin Mathe
Author: Quentin Mathe <[email protected]>
Date: August 2016
License: MIT
*/
#import "CQFormCell.h"
@implementation CQFormCell
- (UITextField *)textField
{
if (![self.editor isKindOfClass: [UITextField class]])
{
[NSException raise: NSInternalInconsistencyException
format: @"Editor must be a UITextField to get accessed with -textField"];
}
return (UITextField *)self.editor;
}
- (void)setTextField: (UITextField *)textField
{
self.editor = textField;
}
- (void)setEditor: (UIView *)anEditor
{
if (_editor != nil)
{
//anEditor.frame = editor.frame;
//anEditor.autoresizingMask = editor.autoresizingMask;
[_editor removeFromSuperview];
}
_editor = anEditor;
if (anEditor != nil)
{
[self.contentView addSubview: anEditor];
}
}
- (UILabel *)valueLabel
{
return _label;
}
- (UIView *)valueEditor
{
return ([self.editor isKindOfClass: [UIControl class]] || [self.editor isKindOfClass: [UITextView class]] ? self.editor : nil);
}
@end