-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathUITableView+Extensions.m
More file actions
24 lines (19 loc) · 883 Bytes
/
Copy pathUITableView+Extensions.m
File metadata and controls
24 lines (19 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#import "UITableView+Extensions.h"
@implementation UITableView (Extensions)
static NSMutableDictionary* classNames = nil;
+ (NSString*) stringFromClass: (Class) theClass; {
if (!classNames) classNames = [[NSMutableDictionary alloc] init];
NSString* result = [classNames objectForKey: theClass];
if (!result) {
result = NSStringFromClass(theClass);
[classNames setObject: result forKey: theClass];
}
return result;
}
- (UITableViewCell*) cellForClass: (Class) cellClass; {
UITableViewCell* result = [self dequeueReusableCellWithIdentifier: [UITableView stringFromClass: cellClass]];
if (!result)
result = [[[cellClass alloc] initWithStyle:UITableViewStylePlain reuseIdentifier: [UITableView stringFromClass: cellClass]] autorelease];
return result;
}
@end