The methods called when locking the device with your app currently in foreground are in order
-[MyAppDelegate applicationWillResignActive:]
-[MyAppDelegate applicationDidEnterBackground:]
-[MyAppDelegate applicationWillEnterForeground:]
-[MyAppDelegate applicationDidBecomeActive:]
The first two are called when locking, the others when unlocking