-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathUITableView+Additions.m
42 lines (31 loc) · 1.23 KB
/
UITableView+Additions.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
//
// UITableView+Additions.m
// Additions
//
// Created by jlopez on 2/25/10.
// Copyright 2010 JLA. All rights reserved.
//
#import "UITableView+Additions.h"
@implementation UITableView (JLAdditions)
- (UITableViewCell *)dequeueCellWithStyle:(UITableViewCellStyle)cellStyle reuseIdentifier:(NSString *)reuseIdentifier {
UITableViewCell *cell = [self dequeueReusableCellWithIdentifier:reuseIdentifier];
if (!cell)
cell = [[[UITableViewCell alloc] initWithStyle:cellStyle reuseIdentifier:reuseIdentifier] autorelease];
return cell;
}
- (id)dequeueReusableCellOfClass:(Class)cls {
NSString *cellIdentifier = NSStringFromClass(cls);
id cell = (id)[self dequeueReusableCellWithIdentifier:cellIdentifier];
if (!cell)
cell = [[[cls alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier] autorelease];
return cell;
}
- (id)placeholderCellWithText:(NSString *)text {
UITableViewCell *cell = [self dequeueCellWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"PlaceholderCell"];
cell.textLabel.text = text;
cell.textLabel.textAlignment = UITextAlignmentCenter;
cell.textLabel.textColor = [UIColor lightGrayColor];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
@end