-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathSLSCellTextView.m
executable file
·59 lines (47 loc) · 1.26 KB
/
SLSCellTextView.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
55
56
57
58
59
//
// SLSCellTextView.m
// Molecules
//
// The source code for Molecules is available under a BSD license. See License.txt for details.
//
// Created by Brad Larson on 6/30/2008.
//
// This class is based on Apple's example from the Recipes sample application, with only minor modifications
#import "SLSCellTextView.h"
// cell identifier for this custom cell
NSString* kSLSCellTextView_ID = @"SLSCellTextViewID";
@implementation SLSCellTextView
@synthesize view;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)identifier
{
self = [super initWithStyle:style reuseIdentifier:identifier];
if (self)
{
// turn off selection use
self.selectionStyle = UITableViewCellSelectionStyleNone;
}
return self;
}
- (void)setView:(UITextView *)inView
{
view = inView;
[self.view retain];
[self.contentView addSubview:inView];
[self layoutSubviews];
}
- (void)layoutSubviews
{
[super layoutSubviews];
CGRect contentRect = [self.contentView bounds];
// inset the text view within the cell
self.view.frame = CGRectMake( contentRect.origin.x + 8.0f,
contentRect.origin.y + 8.0f,
contentRect.size.width - 16.0f,
contentRect.size.height - 16.0f);
}
- (void)dealloc
{
[view release];
[super dealloc];
}
@end