Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Load a NSTableCellView from a NIB
@interface NSTableCellView (JKNibLoading)
+ (instancetype) tableCellViewWithNibNamed:(NSString *)nibName owner:(id)owner;
@implementation NSTableCellView (JKNibLoading)
+ (instancetype) tableCellViewWithNibNamed:(NSString *)nibName owner:(id)owner
NSTableCellView *view = nil;
NSArray * topLevelObjects = nil;
NSNib * nib = [[NSNib alloc] initWithNibNamed:nibName bundle:nil];
if (!nib || ![nib instantiateNibWithOwner:owner topLevelObjects:&topLevelObjects]) {
return nil;
for (id obj in topLevelObjects) {
if ([obj isKindOfClass:[self class]]) {
view = obj;
return view;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment