Welcome to Soft32 Forums!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Change default order for loading object in a nib file

 
   Soft32 Home -> Mac -> Programmer Help RSS
Next:  Best way to organize notes?  
Author Message
abirtz

External


Since: Jun 01, 2009
Posts: 1



(Msg. 1) Posted: Mon Jun 01, 2009 4:49 am
Post subject: Change default order for loading object in a nib file
Archived from groups: comp>sys>mac>programmer>help (more info?)

The object in the nib file are MainMenu, Window1, Window2, ...
MainMenuController, Window1Controller, Window2Controller...

How to change the default order such Window2 will be loaded before
Window1 ?
i.e. awakeFromNib in Window2Controller will be called before
awakeFromNib in Window1Controller.

A solution is to make a nib file for each controller and use loadNib
but is it possible to change the load order with only one nib ?
Back to top
Login to vote
matt neuburg

External


Since: Jun 12, 2005
Posts: 3141



(Msg. 2) Posted: Mon Jun 01, 2009 9:12 am
Post subject: Re: Change default order for loading object in a nib file [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

<abirtz.RemoveThis@gmail.com> wrote:

> The object in the nib file are MainMenu, Window1, Window2, ...
> MainMenuController, Window1Controller, Window2Controller...
>
> How to change the default order such Window2 will be loaded before
> Window1 ?
> i.e. awakeFromNib in Window2Controller will be called before
> awakeFromNib in Window1Controller.

If you're concerned about this, you're doing something wrong. Smile There
are absolutely no guarantees about order, nor should you need any. The
idea is to use the guarantees that you *do* get. For example, you are
guaranteed that by the time awakeFromNib is called for an object, its
outlets are working.

http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/
Protocols/NSNibAwaking_Protocol/Reference/Reference.html

Notice that that page is quite clear on the fact that you MUST NOT rely
on any assumptions about loading order. End of story.

So, what's the *real* problem you're having? For example, if the problem
is merely that you don't want to run code in window1's awakeFromNib
until window2 is loaded and initialized, just run an outlet from the one
to the other. m.

--
matt neuburg, phd = matt.RemoveThis@tidbits.com, http://www.tidbits.com/matt/
Leopard - http://www.takecontrolbooks.com/leopard-customizing.html
AppleScript - http://www.amazon.com/gp/product/0596102119
Read TidBITS! It's free and smart. http://www.tidbits.com
Back to top
Login to vote
Display posts from previous:   
Related Topics:
NSArchiver, change object-graph in vivo ? - Hello NG, In my application i store the objects with NSArchiver one the disk. Now, I want to program a update with som...

manipulating file order - I hope someone can help me, I believe this is probably a simple question for someone knowlegable. I am using the..

help determining mp3 file order - Hello all. I am using an old imac and developing a program to move files(mp3's) to a memory card. No sweat. The problem...

Error while loading NIB file - Dear all, I updated only recently to the last versions of XCode and IB. After this upgrade, I recompiled one of my..

Loading NIB file problem - Houston we have a problem! I wrote some code for standart Carbon Application. App works fine, it has some edits,..

Sending message to Objective-C object from C file - Hi everyone, I am an experienced programmer but quite new in Mac OS programming. I am developing a Cocoa application....
       Soft32 Home -> Mac -> Programmer Help All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum

Categories:
 Windows
 Linux
  Mac
 PDA


[ Contact us | Terms of Service/Privacy Policy ]