Created
April 27, 2011 15:50
-
-
Save yene/944523 to your computer and use it in GitHub Desktop.
loading nib and obtaining ref to the nswindow, all in code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSMutableArray* topLevelObjs = [NSMutableArray array]; | |
NSDictionary* nameTable = [NSDictionary dictionaryWithObjectsAndKeys:self, NSNibOwner, topLevelObjs, NSNibTopLevelObjects, nil]; | |
if (![[NSBundle mainBundle] loadNibFile:@"bla" externalNameTable:nameTable withZone:nil]) { | |
NSLog(@"trouble loading bla.xib"); | |
return; | |
} | |
for (id object in topLevelObjs) { | |
if ([object isKindOfClass:[NSWindow class]]) { | |
[object makeKeyAndOrderFront:nil]; | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment