-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTLEditInPlaceTableViewCell.m
54 lines (40 loc) · 1.31 KB
/
TLEditInPlaceTableViewCell.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
54
//
// EditInPlaceTableViewCell.m
// fourchat
//
// Created by Joshua Bleecher Snyder on 10/16/09.
//
#import "TLEditInPlaceTableViewCell.h"
#import "UITableViewCell_TLCommon.h"
#import "CGGeometry_TLCommon.h"
#pragma mark -
@interface TLEditInPlaceTableViewCell ()
@property(nonatomic, retain, readwrite) UITextField *textField;
@end
#pragma mark -
@implementation TLEditInPlaceTableViewCell
@synthesize textField;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
if(!self.textField) {
self.detailTextLabel.text = @"\n";
self.detailTextLabel.hidden = YES;
self.textField = [[[UITextField alloc] initWithFrame:CGRectZero] autorelease];
self.textField.font = [UITableViewCell defaultDetailTextLabelFontForCellStyle:style];
self.textField.textColor = [UITableViewCell defaultDetailTextLabelColorForCellStyle:style];
[self.contentView addSubview:self.textField];
}
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
[self layoutSubviews];
self.textField.frame = self.detailTextLabel.frame;
}
- (void)dealloc {
[textField release];
textField = nil;
[super dealloc];
}
@end