Re: are there any custom IB Palettes?
Re: are there any custom IB Palettes?
- Subject: Re: are there any custom IB Palettes?
- From: Vince DeMarco <email@hidden>
- Date: Sat, 28 Feb 2004 20:40:42 -0800
On Feb 27, 2004, at 10:49 PM, Wade Tregaskis wrote:
Sorry for digging up an old topic, but I've finally gotten around to
looking at this again, and am having trouble with it still.
I recently wrote an IB palette for a few custom NSView subclasses,
and found it extremely difficult to do properly. In particular, one
subclass would invoke authorisation functions as part of it's normal
operation, which of course you don't want it doing in IB, but
there's no apparent way to differentiate between an instance in IB
and in the final app.
This is easy.
If you look in the IBApplicationAdditions.h header file in the
InterfaceBuilder framework you will notice this IB protocol which the
Application object in IB responds to
- (BOOL)isTestingInterface;
So if NSApp responds to selector isTestingInterface you are in
Interface Builder, if isTestingInterface returns yes, you are testing
the interface.
What exactly do you mean by 'NSApp'? NSApplication never responds to
'isTestingInterface', even when in IB, and it's not obvious from the
InterfaceBuilder framework headers exactly what object is supposed to.
I've fiddled around and probed various avenues without any success.
So far as I can tell, nothing implements the 'IB' protocol as defined
in InterfaceBuilder/IBApplicationAdditions.h.
do this
[NSApp respondsToSelector:@selector(isTestingInterface)]
NSApp is a global variable that represents the application object.
Nothing implements it in the header file, the only thing that does is
IBApplication which is only in InterfaceBuilder.
You need to do this at run time
vince
_______________________________________________
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.