Skip to content

Commit

Permalink
Make UKNibOwner work with classes in frameworks/plug-ins as well
Browse files Browse the repository at this point in the history
We fall back on the main bundle if our bundle doesn't contain the requested NIB file.
  • Loading branch information
uliwitness committed Sep 27, 2012
1 parent 88737da commit aad4c7f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion UKNibOwner.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -64,10 +64,16 @@ -(id) initWithNibName: (NSString*)nibName owner: (id)owner
owner, @"NSOwner", owner, @"NSOwner",
topLevelObjects, @"NSTopLevelObjects", topLevelObjects, @"NSTopLevelObjects",
nil]; nil];
NSBundle* mainB = [NSBundle mainBundle]; NSBundle* mainB = [NSBundle bundleForClass: [self class]];
if( nibName ) if( nibName )
[mainB loadNibFile: nibName externalNameTable: ent withZone: [self zone]]; // We're responsible for releasing the top-level objects in the NIB (our view, right now). [mainB loadNibFile: nibName externalNameTable: ent withZone: [self zone]]; // We're responsible for releasing the top-level objects in the NIB (our view, right now).
if( nibName && [topLevelObjects count] == 0 ) if( nibName && [topLevelObjects count] == 0 )
{
mainB = [NSBundle mainBundle];
if( nibName )
[mainB loadNibFile: nibName externalNameTable: ent withZone: [self zone]]; // We're responsible for releasing the top-level objects in the NIB (our view, right now).
}
if( nibName && [topLevelObjects count] == 0 )
{ {
NSLog(@"%@: Couldn't find NIB file \"%@.nib\".", NSStringFromClass([self class]), nibName); NSLog(@"%@: Couldn't find NIB file \"%@.nib\".", NSStringFromClass([self class]), nibName);
[self autorelease]; [self autorelease];
Expand Down

0 comments on commit aad4c7f

Please sign in to comment.