开发者

To set an order of initialization of objects at an application launch

开发者 https://www.devze.com 2023-01-19 19:40 出处:网络
It is possible toset an order of initialization of objects at an application launch? For example: I have two objects in IB: myObj1, myObj2.

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!


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消