[fbcocoa] Re: [fbcocoa] Nibless Tutorials

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : September 2011 : Group Archive : Group : All Groups

From: Bernie <fbcocoa.bw@...>
Date: Mon, 5 Sep 2011 22:23:27 +0100
Brian wrote:

> Pluses for using nibless:
> (1) FB compatible because FB doesn’t work with Cocoa nibs

Below is Steve's Tutorial_2 using Cocoa nib (attached).
'---------------
compile as "Objective-C"

include resources "main.xib"

BeginCDeclaration
@interface MyWindowController : NSWindowController
{
     IBOutlet NSWindow *window;
}
- (IBAction)beep:(id)sender;
@end //interface
EndC

BeginCFunction
@implementation MyWindowController
- (IBAction)beep:(id)sender {
     NSBeep();
}
@end //implementation
EndC

BeginCCode
{
  MyWindowController *controller = [[MyWindowController alloc] initWithWindowNibName:@"main"];
  [controller.window makeKeyAndOrderFront:nil];
  [NSApp run];
}
EndC
'---------------


If the nib doesn't make it through the server, I'll stuff it in FBCocoa's files area.

Bernie