Re: Window variants
Re: Window variants
- Subject: Re: Window variants
- From: Uli Kusterer <email@hidden>
- Date: Fri, 20 Apr 2007 10:19:58 +0200
Am 20.04.2007 um 06:07 schrieb James Merkel:
Is there an easy way of providing two variants of a window where
the second window is just like the first except it doesn't have a
particular NSView? The NSView contains a histogram, so it takes
some time to create. I would like to give the user an option of not
having the histogram in order to speed things up. I guess I could
create two different nibs one with and one without the NSView, but
that's a lot of duplication of work.
Well, the simple approach would be to have your histogram view use
lazy loading and make it hidden by default (There's a checkbox in IB
to do that, and there's setIsHidden: or something like that to re-
show/re-hide it). Make it only install its timers, or draw, once it's
been shown.
If that for some reason doesn't work (it should!) you could also
create a NIB with a placeholder view (just drag a generic NSView in)
where the histogram would be. Then in code create the histogram view
to fit in that NSView, or put the histogram in a second NIB (you can
drag views into the top level of your window to have a view for
insertion into an existing window). You'll have to use NSNibLoading
stuff to manually load that view, and don't forget to release it and
all its top-level objects afterwards (loading NIBs is one of the few
exceptions, The function loadNibNamed:... doesn't contain "alloc",
"init" or "copy" but you're still responsibe for deleting the top-
level NIB objects).
But really, hiding and showing and a few strategic "if"s in your
histogram class should be all it takes.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden