Re: Get specified window from nib
Re: Get specified window from nib
- Subject: Re: Get specified window from nib
- From: Negm-Awad Amin <email@hidden>
- Date: Tue, 12 Aug 2008 08:44:57 +0200
Am Di,12.08.2008 um 05:08 schrieb Fosse:
In fact, in my another application, there are more than one hundred
windows..
Hmmmm
split them into one hundred nib?
Yes, but: …
and create one hundred Outlet?
No, only one. Typically a window has a window controller. The
relationship between window-controller and window is (typically but
not neccessarily) 1:1. One window controller per window, one window
per window controller.
So you have 100 window controllers? Yes, if all these 100 windows are
on screen at the same time. You load the nib (the window controller)
dynamically. So you have as many window controllers (and loaded nibs)
as open windows.
The window cotrollers are typically stored in an array. You have one
array. If you use a subclass of NSDocument, the document will do that
for you. If you do not have a subclass of NSDocument, probably your
application-delegate should have a window controller array.
Beside the advantages of this design in relation to memory usage you
get the ability to reinstantiate the same window type as many times as
you want. I cannot believe, that you have 100 windows of different
types. If you have 10 windows of 10 different types, you need 10 nibs
(for each type) and as many instances (loaded nibs) as windows are on
the screen.
Seems a little too crazy!
Yup, the reason is, that 100 windows are a little too crazy.
Amin
On Tue, Aug 12, 2008 at 12:59 AM, Michael Ash
<email@hidden> wrote:
On Sun, Aug 10, 2008 at 10:01 PM, Fosse <email@hidden> wrote:
I have one nib containing more than ten dialogs and want to get the
specified window after nib is loading..
Don't take this badly, but if you have one nib with ten windows and
you only want to access one of them, you're doing it wrong. Separate
nibs will be easier to work with and will be more efficient (you
don't
have to create and then destroy nine windows you don't care about
every time you load one you do care about).
If I use FileOwner and binding, I need to add a lot of Outlets in
the
fileOwner class and create the binding in the IB.. Is there a more
convenient way to get the specified window by passing the window
name
and
nib reference like Carbon?
Create one outlet to each window. Ten outlets doesn't seem like an
enormous hardship.
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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
Amin Negm-Awad
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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