When exactly should I call [super viewWillAppear:] and when not? When exactly should I call [super viewWillAppear:] and when not? objective-c objective-c

When exactly should I call [super viewWillAppear:] and when not?


Even though not calling the super implementation can be harmless sometimes, you should ALWAYS call [super viewWillAppear:], regardless of the bad examples Apple publishes. Not doing it may lead to very nasty issues to track down.

According to the documentation

If you override this method, you must call super at some point in your implementation.

The specific example you mentioned is broken in a more subtle way: they implemented viewWillAppear instead of viewWillAppear:, so that piece of code is not even being executed!


in short: always.

if you don't that can cause issues that are hard to track