Possible Duplicate:
When should I call super?
Is there is difference/preferred way when placing calls to the super class methods like [super viewDidLoad] or [super init] or [super viewDidUnload]? I have seen tutorials putting them either in the first line or as the last line in a child class method. I am just wondering if there would be any dependency like if the super class method would do some setup the child could use when called upfront or if the super could do some optimizations to something the child has done when called at the end.
My general rule of thumb is that acts of construction/creation call through
superfirst, while acts of destruction or tearing down state happen in reverse order —superis called last. There’s rarely a need to deviate from that.The reason is not typically for optimization (as asked in your post), but for predictable semantics.
Example A:
construction:
destruction:
Example B:
construction:
destruction: