This repository was archived by the owner on Nov 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathNibwareNibUtils.m
More file actions
48 lines (41 loc) · 1.4 KB
/
NibwareNibUtils.m
File metadata and controls
48 lines (41 loc) · 1.4 KB
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
//
// NibwareNibUtils.m
// pingle
//
// Created by robertsanders on 1/18/09.
// Copyright 2009 Robert Sanders. All rights reserved.
//
#import "NibwareNibUtils.h"
@implementation NibwareNibUtils
+ (UITableViewCell*) loadReusableCell:(NSString*)cellid fromNib:(NSString *)nibName
{
NSArray* nibContents = [[NSBundle mainBundle]
loadNibNamed:nibName owner:self options:nil];
NSEnumerator *nibEnumerator = [nibContents objectEnumerator];
UITableViewCell* newcell = nil;
NSObject* nibItem = nil;
while ( (nibItem = [nibEnumerator nextObject]) != nil) {
if ( [nibItem isKindOfClass: [UITableViewCell class]]) {
newcell = (UITableViewCell*) nibItem;
if ([newcell.reuseIdentifier isEqual: cellid])
break; // we have a winner
else
newcell = nil;
}
}
return newcell;
}
+ (UITableViewCell*) loadNewCellfromNib:(NSString *)nibName
{
NSArray* nibContents = [[NSBundle mainBundle]
loadNibNamed:nibName owner:self options:nil];
NSEnumerator *nibEnumerator = [nibContents objectEnumerator];
NSObject* nibItem = nil;
while ( (nibItem = [nibEnumerator nextObject]) != nil) {
if ( [nibItem isKindOfClass:[UITableViewCell class]]) {
return (UITableViewCell*) nibItem;
}
}
return nil;
}
@end