Dans une nib, vous avez une fenêtre (NSWindow) et un panel (NSPanel), par exemple. Maintenant, dans la méthode awakeFromNib vous écrivez :
– (void) awakeFromNib
{
[NSApp runModalForWindow: mainPanel];
NSLog(@”%s”, __PRETTY_FUNCTION__);
}
Si votre fenêtre possède l’attribut “Visible at launch time”, celle-ci ne risque pas de s’afficher tant que le panel ne sera pas fermé. Ceci car awakeFromNib est la première méthode appelée… De même si vous tentez de modifier le menu, il n’apparaîtra pas. Logique me direz-vous, mais il faut y penser !
In your nib file you have a NSWindow and a NSPanel. Now write the following code :
– (void) awakeFromNib
{
[NSApp runModalForWindow: mainPanel];
NSLog(@”%s”, __PRETTY_FUNCTION__);
}
If you window has the “Visible at launch time” attribute set, that window will not display until the panel is not dismissed. This is because awakeFromNib is called first before all other methods… We will have the same behavior if you try to change the application menu at run-time. That menu will not display.
0 Comments