I’m an Xcode newbie, and I know it’s kind of a stupid question, however I haven’t found anything on the matter (maybe wrong search parameters).
Anyway, here’s the problem: How do you run a method at application start/end?
Details: I’m making a flashlight app with a button that turns the LED on/off and changes the title of the button(“Turn flash on”/”Turn flash off”);
Everything is ok, but when I exit the app(home button) while the flash is on and run the app again, it keeps the settings from the last run(button title is “Turn flash off” and the ison BOOL stays YES);
So, how do I fix that?
I tried making a method 'changetitle: (NSString *)text' and placing it in 'dealloc', 'viewDidLoad','viewDidUnload' but they only work when app has a ‘fresh’ run (closed from multitasking = twice home button and quit there), so it’s useless.
Do I need to call the method from main? It seems unnecessary.
UIApplicationDelegate Protocol Reference
These are the methods you looking for.
On Ross Alexander suggestion: