bkbeachlabs
bkbeachlabs

Reputation: 2171

declaring methods in my header file

easy question to ask, but not really sure what to search for to find an answer for this one.

do I have to declare the method

- (void) applicationWillResignActive:(NSNotification *) notification;

in my header file? I'm trying to build my first app and im just going through trying to clean up my code.

Thanks!

Upvotes: 0

Views: 95

Answers (2)

Pochi
Pochi

Reputation: 13459

No you don't have to. These are methods that will allow you to perform certain actions in some conditions, in the case of this one is when your application is about to go to the background. If you don't implement it nothing will happen. It is the same as with "viewWillAppear" and so on.

Also those methods only have to be implemented in the .m file since they come from the parent class. Since you are probably placing it in an object that comes from an UIViewController subclass.

Upvotes: 3

Nathan Kinsinger
Nathan Kinsinger

Reputation: 25021

The method applicationWillResignActive: is an optional method in the UIApplicationDelegate protocol. Your app delegate should already have declared that it conforms to that protocol in its header. So since it is already declared you don't have to declare it again.

Upvotes: 0

Related Questions