Skip to content

Instantly share code, notes, and snippets.

@petermaurer
Created February 17, 2014 18:37
Show Gist options
  • Save petermaurer/9056376 to your computer and use it in GitHub Desktop.
Save petermaurer/9056376 to your computer and use it in GitHub Desktop.
@implementation NSBundle (PMExtensions)
+ (BOOL)vintageStyleLoadNibNamed: (NSString*)theName owner: (id)theOwner {
#if __MAC_OS_X_VERSION_MIN_REQUIRED<__MAC_10_8
return [self loadNibNamed: theName owner: theOwner];
#else
BOOL didLoad = NO;
NSNib *theNib = [[NSNib alloc] initWithNibNamed: theName bundle: nil];
if (theNib) {
NSArray *theTopLevelObjects = nil;
if ([theNib instantiateWithOwner: theOwner topLevelObjects: &theTopLevelObjects]) {
for (id aTopLevelObject in theTopLevelObjects) {
[aTopLevelObject retain];
}
didLoad = YES;
}
[theNib release];
}
return didLoad;
#endif
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment