Reputation: 47348
I need to add a 4 digit pin view controller that would "hover" over my app's main window and prevent users who do not know the pin from browsing data within the app.
I'm interested if there are any demo projects or open source projects that accomplish this functionality (key clicks, automatically changing focus, displaying a static glossy keyboard, lock after x amount of seconds).
Thank you for your input!
Upvotes: 6
Views: 7904
Reputation: 17732
Making my own custom alert view, somewhat following this tutorial, I was able to make a PIN-entry view that covers the entire window, thus absorbing all input. I then put code in applicationWillResignActive
and applicationDidBecomeActive
to determine how long the app has been minimized for, in order to present the PIN entry window based on the user's preference settings. Don't forget, you want to store the PIN in a secure manner, I recommend using the built-in keychain.
Upvotes: 2
Reputation: 1341
not sure of any demo apps, but you have hooks to do this like...
app delegates 'applicationWillEnterForeground' and 'applicationDidBecomeActive'
also might matter if your app is enabled to run in background or not how you go about implementing it.
In my app I have it set up to navigate the user to home screen anytime the app becomes active/enters foreground. The home screen controller then determines if the user is still logged in/active and if they aren't it pushes a login view controller on the stack.
Upvotes: 5