views:

16

answers:

1

It is possible to set an order of initialization of objects at an application launch?

For example: I have two objects in IB: myObj1, myObj2. Both of them implement method -initWithCoder: Properties of objects sets in IB. myObject2 Initialize is depend from properties of myObj1.

Question: Is exist methods that set order of objects initialization? I must be sure that myObj1 will ALWAYS be initialized before myObject2 in runtime.

Thanks!

A: 

You should read "The Object Loading Process" in the Resource Programming Guide. Essentially if your design requires a specific loading order within the same nib, you're doing something wrong. You should put critical "once the contents of this nib/xib are loaded" code in -awakeFromNib.

If this doesn't answer your question well enough, it might be best to state exactly why the dependency you described exists.

Joshua Nozzi
Thank you for answer. The tutorial was very helpful to me.I decided to resolve my problem by implement -awakeFromNib method for my custom object. He will invoked after initWithCoder, end I can init myObj2 with myObj1 properties.