Update, 29 May 2014: Check the 3.0.0 version here.
I haven't found any proper Passcode classes for iOS 7, so I gave my best at creating one: a simple to use, iOS 7 style (replica, if you will) Passcode view controller (not the Lock Screen one, but the one you get when changing your passcode in Settings). Can be used for iOS 6 too, albeit it might need a few modifications, haven't tested it.
I made it a singleton because if the lock is active, when leaving the app a view must be placed on top, so no data from within the app can be seen in the multitasking mode. This is done under the hood, without having to do anything extra.
- When opened from Settings, as a modal:
- (void)showForEnablingPasscodeInViewController:(UIViewController *)viewController; - (void)showForChangingPasscodeInViewController:(UIViewController *)viewController; - (void)showForTurningOffPasscodeInViewController:(UIViewController *)viewController; // Example: [[LTHPasscodeViewController sharedUser] showForEnablingPasscodeInViewController: self]
- At app launch, or whenever you'd like the user to require a passcode entry:
- (void)showLockscreen; // Example: [[LTHPasscodeViewController sharedUser] showLockscreen] // Displayed with a slide up animation, which, combined with // the keyboard sliding down animation, creates an "unlocking" impression.
- entering foreground and resigning is handled from within the class.
Everything is easily customisable with macros and static constants.
Makes use of SFHFKeyChainUtils to save the passcode in the Keychain. I know he dropped support for it, but I updated it for ARC 2 years ago (with help) and I kept using it since. The 'new' version isn't updated to ARC anyway, so I saw no reason to switch to it.
Rather than writing a big documentation, I heavily commented it as best as I could. Here's the repo and here are two screenshots: