Subject: Re: Clarification regarding viewDidAppear: and
1) If the default implementation does nothing, why must I invoke
super when overriding this method?
You're right, that's confusing. Could be several answers though: maybe
super does nothing visible, but still something; or maybe super could
start doing something in the future. It's better to be prepared, but
without more info from Apple, it's hard to say.
2) viewDidAppear: and its friends all take a boolean argument but I
don't understand what it's for. In the case of viewDidAppear:, for
instance, the view has already been fully displayed, so what
animations is the description above talking about? Note, for
instance, that the description explicitly says
"Sent to the controller after the view fully appears and animations
So, again, if the animations have ended, what's the boolean argument
Suppose you do all sorts of stuff when animated is YES and you set it
all up in viewWillAppear:. The place to clean up all that stuff would
be viewDidAppear:. The boolean is there so you can coordinate the
behavior with viewWillAppear:.
3) The documentation for each of those methods says:
"Subclasses may override this method to take an appropriate action.
When doing so, they must invoke super."
Now, should I invoke super before or after my custom code?
That would depend on what your code does and what super does. If super
doesn't do anything (like the docs say) it shouldn't matter.
Generally, I like to nest things, so in viewWillAppear I will put my
custom code first and then invoke super, and in viewDidAppear I'd
invoke super first and then have my custom code.
I will send a documentation enhancement request, but I thought I'd
check with the list first to make sure I'm not missing something
I'd file the request.
hankh at runbox dot com
Cocoa-dev mailing list (Cocoa-dev@xxxxxxxxxxxxxxx)
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 maillists@xxxxxxxxx