cpprulez
cpprulez

Reputation: 896

iOS SDK: Is there a way to recognize when a user double taps the home button and when he locks the screen

Is there a way to make a difference between the user tapping the home button twice and the user locking the screen? I know that in both cases the app delegate's method applicationWillResignActive: is called, but I'd like to able to tell exactly which event has happened. Any method to do that? Thank you!

Upvotes: 3

Views: 1218

Answers (2)

EricLeaf
EricLeaf

Reputation: 902

Doesn't appear to be a way in a app store app. You can probably do this with private methods.

I attempted to observe these changes, but the home store double press doesn't modify your frame or window data (like say the phone call status does). So you wouldn't be able to tell when you have been moved up to show the home button bar thru observation.

Upvotes: 1

chown
chown

Reputation: 52728

From looking at UIApplicationDelegate Protocol Reference:

applicationWillResignActive:
// Then when its back, this gets called:
applicationDidBecomeActive:

are the only methods that gets called in this situation. So unfortunately, the answer is no, there is no way to tell the difference between locking the device, and double clicking the home button.

Upvotes: 2

Related Questions