Skip to content

Instantly share code, notes, and snippets.

@twoism
Created August 4, 2009 14:45
Show Gist options
  • Save twoism/161285 to your computer and use it in GitHub Desktop.
Save twoism/161285 to your computer and use it in GitHub Desktop.
//
// UITableViewCell+CustomNib.h
// UBlossom
//
// Created by Christopher Burnett on 7/22/09.
// Copyright 2009 digital scientists, llc. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface UITableViewCell (CustomNib)
- (id)initWithNibName:(NSString*)nibName reuseIdentifier:(NSString *)reuseIdentifier;
@end
//
// UITableViewCell+CustomNib.m
// UBlossom
//
// Created by Christopher Burnett on 7/22/09.
// Copyright 2009 digital scientists, llc. All rights reserved.
//
#import "UITableViewCell+CustomNib.h"
@implementation UITableViewCell(CustomNib)
- (id)initWithNibName:(NSString*)nibName reuseIdentifier:(NSString *)reuseIdentifier{
if (self = [self initWithFrame:CGRectZero reuseIdentifier:reuseIdentifier]) {
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:nibName owner:nil options:nil];
for(id currentObject in topLevelObjects) {
if([currentObject isKindOfClass:[self class]]) {
self = currentObject;
break;
}
}
}
return self;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment