Tutorial for Xcode 4
Create new project and add the following to AppDelegate.h and AppDelegate.m.
AppDelegate.h
#import <Cocoa/Cocoa.h>
@interface AppDelegate : NSObject <NSApplicationDelegate> {
IBOutlet NSPanel *theSheet;
}
@property (assign) IBOutlet NSWindow *window;
@end
AppDelegate.m
#import "AppDelegate.h"
@implementation AppDelegate
@synthesize window = _window;
- (IBAction) showTheSheet:(id)sender {
[NSApp beginSheet:theSheet
modalForWindow:(NSWindow *)_window
modalDelegate:self
didEndSelector:nil
contextInfo:nil];
}
-(IBAction)endTheSheet:(id)sender {
[NSApp endSheet:theSheet];
[theSheet orderOut:sender];
}
@end
Open the MainMenu.xib.
Use the existing NSWindow.
Make it visible using the following button:
Create one new NSPanel.
Add the appropriate NSButtons.

Connect Close to the App Delegate.

And select endTheSheet.
Connect Open to the App Delegate.

And select showTheSheet.
Connect the App Delegate to the new NSPanel.

And select theSheet.

Select the NSPanel and disable Visible At Launch.
(Essential step!)

Now hit run and enjoy the result:
