/
CLCGMoreCell.m
85 lines (63 loc) · 1.65 KB
/
CLCGMoreCell.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//
// CLCGMoreCell.m
// Goodreads
//
// Created by Ettore Pasquini on 10/29/12.
//
//
#import "clcg_macros.h"
#import "UIViewCategory.h"
#import "CLCGMoreCell.h"
@implementation CLCGMoreCell
-(void)dealloc
{
CLCG_REL(mSpinner);
[super dealloc];
}
-(id)initReusingId:(NSString*)reuse_id
{
return [self initReusingId:reuse_id withText:CLCG_LOC(@"More...")];
}
// designated initializer
-(id)initReusingId:(NSString*)reuse_id withText:(NSString*)text
{
self = [super initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:reuse_id];
if (self) {
[self setSelectionStyle:UITableViewCellSelectionStyleBlue];
[[self textLabel] setNumberOfLines:1];//set to 0 and calc height dynamically
[[self textLabel] setTextColor:[UIColor blackColor]];
[[self textLabel] setBackgroundColor:[UIColor clearColor]];
[[self textLabel] setTextAlignment:UITextAlignmentCenter];
[[self textLabel] setText:text];
[[self textLabel] setFont:[UIFont boldSystemFontOfSize:18]];
mSpinner = [[UIActivityIndicatorView alloc]
initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
[self setAccessoryView:mSpinner];
[mSpinner setHidden:YES];
}
return self;
}
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)reuse_id
{
return [self initReusingId:reuse_id];
}
-(void)didStartRequestingMore
{
[mSpinner startAnimating];
[mSpinner setHidden:NO];
}
-(void)didStopRequestingMore
{
[mSpinner stopAnimating];
[mSpinner setHidden:YES];
}
-(void)layoutSubviews
{
[super layoutSubviews];
[[self textLabel] setW:[self width]];
}
+(CGFloat)cellHeight
{
return 50.0f; //TODO-XX
}
@end