CocoaDev

Edit AllPages

Is this the best way to create a splash window?

* SplashWindow.h

#import <Cocoa/Cocoa.h>

@interface SplashWindow : NSWindow {

}

@end

* SplashWindow.m

#import “SplashWindow.h” #import <AppKit/AppKit.h>

@implementation SplashWindow

@end


I don’t know if I would use NSStatusWindowLevel, that makes a floating window that stays above all other windows. What if a user wanted to switch to another application while your program was launching?


NSStatusWindowLevel wouldn’t be objectionable if the window was set to hide on deactivate. Although I find splash windows in general objectionable unless they show some sort of useful information about the app’s startup progress.


I’d use something more like this…

@implementation SplashWindow

@end

Of course, it could borrow from the lower ToolTip example to return an autoreleased SplashWindow that displays for a set amount of time. Then using it would be real simple… [SplashWindow splashWithImage:yourImage display:YES];