Re: IB calling init of AppKit subclass [was Re: Window Styles]
Re: IB calling init of AppKit subclass [was Re: Window Styles]
- Subject: Re: IB calling init of AppKit subclass [was Re: Window Styles]
- From: Brent Gulanowski <email@hidden>
- Date: Sun, 16 May 2004 16:35:04 -0400
On May 16, 2004, at 11:49 AM, Vince DeMarco wrote:
>
>
On May 16, 2004, at 7:45 AM, Brent Gulanowski wrote:
>
>
> On May 15, 2004, at 4:57 AM, Jeremy Dronfield wrote:
>
>
>
>> What you're referring to as plain is called a "borderless" window,
>
>> and
>
>> you can't do it in IB. Instead, create your window as normal in IB,
>
>> then subclass NSWindow and set your window's Custom Class to your
>
>> subclass. In the subclass's implementation file, initialise the
>
>> window
>
>> like so:
>
>>
>
>> - (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned
>
>> int)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag
>
>> {
>
>>
>
>> if (self = [super initWithContentRect:contentRect
>
>> styleMask:NSBorderlessWindowMask // this is the important bit
>
>> backing:NSBackingStoreBuffered
>
>> defer:NO]) {
>
>>
>
>> return self;
>
>> }
>
>>
>
>> return nil;
>
>> }
>
>
>
> I sent a question to the list last week wherein I was subclassing
>
> NSTableColumn. I overrode the designated initializer just as suggested
>
> here, but after changing the custom class attribute, IB stopped
>
> calling
>
> my init method.
>
>
>
> Ondra basically implied that that was just how it was and provided a
>
> workaround (no-one answered my follow-up question, btw). Jeremy, are
>
> you now saying that it should have worked? Or does it work for some
>
> classes and not others?
>
>
>
>
This is asked all of the time. please look at Interface Builder, under
>
the Help menu there is a FAQ menu.
>
Please check that out.
>
>
it does explain all of this.
>
vince
Sorry to be dense, but I am not sure I agree with you. It mentions the
usual bit about -initWithFrame: and custom views, but then I'm not
creating a custom view. I was creating a subclass of NSTableColumn,
which is subclassed directly from NSObject.
If you will forgive some additional peevishness, the use of a FAQ which
is not connected to the usual documentation is annoyingly consistent
with the recent history of IB documentation: make it irregular, don't
make enough, and hide it in weird places. For example, try searching
it. Even the find window doesn't work past the first term found. I try
to always read the documentation if I know about it. I admit I missed
it this time.
-
Brent Gulanowski email@hidden
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.