-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathBPTextFieldEditableTableViewCell.m
More file actions
66 lines (49 loc) · 1.5 KB
/
BPTextFieldEditableTableViewCell.m
File metadata and controls
66 lines (49 loc) · 1.5 KB
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
//
// BPTextFieldEditableTableViewCell.m
// Brewtool
//
// Created by Jon Olson on 10/14/09.
// Copyright 2009 Ballistic Pigeon, LLC. All rights reserved.
//
#import "BPTextFieldEditableTableViewCell.h"
@implementation BPTextFieldEditableTableViewCell
+ (Class)controlClass {
return [UITextField class];
}
#pragma mark -
#pragma mark Construction and deallocation
- (id)initWithReuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithReuseIdentifier:reuseIdentifier]) {
self.textField.textColor = [UIColor colorWithRed:0.22 green:0.33 blue:0.53 alpha:1];
self.textField.font = [UIFont systemFontOfSize:15.0];
self.textField.delegate = self;
}
return self;
}
- (id)initWithLabel:(NSString *)label placeholder:(NSString *)placeholder reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [self initWithLabel:label reuseIdentifier:reuseIdentifier]) {
self.textField.placeholder = placeholder;
}
return self;
}
#pragma mark -
#pragma mark Control accessor
- (UITextField *)textField {
return (UITextField *)self.control;
}
#pragma mark -
#pragma mark Value accessors
- (id)value {
return self.textField.text;
}
- (void)setValue:(id)aValue {
self.textField.text = [[aValue copy] autorelease];
}
#pragma mark -
#pragma mark UITextFieldDelegate implementation
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
if ([delegate respondsToSelector:@selector(editableTableViewCellShouldReturn:)])
return [delegate editableTableViewCellShouldReturn:self];
return YES;
}
@end