Algorithm Based Lock Screen (http://www.youtube.com/watch?v=YWO2WssNRRo)
NOTE: This project was created in a matter of hours, and is in no way complete.
Before Using!!
To Install --
- Copy directory "Lock Screen Library" into your project.
- #import "LSLockScreen.h" anywhere you need access to the classes.
- continue with the rest of the instructions bellow
Using the lock screen is made to be as easy as possible.
- Create a master password either progromatically, or allow the user to select their own password.
LSPassword *_masterPassword = [[LSPassword alloc] init];
-
Create each required character, and then add it to the master password.
LSPasswordCharacter *char = [LSPasswordCharacter characterWithCharacterColor:LSPasswordCharacterColorNone size:LSPasswordCharacterSizeSmall shape:LSPasswordCharacterShapeNone]; [_masterPassword addPasswordCharacter:char];
LSPasswordPickerViewController *vc = [[LSPasswordPickerViewController alloc] initWithPassword:_masterPassword];
-
Set yourself as the delegate
[vc setDelegate:self];
-
present the LSPasswordPicker [self presentViewController:vc animated:YES completion:nil];
-
Conform to the delegate so you can be notified when the user has finished picking a password
- (void)passwordPickerViewController:(LSPasswordPickerViewController *)passwordPicker returnedWithPassword:(LSPassword *)password { _masterPassword = password; if ([[_masterPassword passwordCharacters] count] > 0) { [lockScreenButton setEnabled:YES]; } [self dismissViewControllerAnimated:YES completion:nil]; }
-
Create the LSLockScreenViewController passing in the master password, as well as a success block and a failure block.
LSLockScreenViewController *vc = [[LSLockScreenViewController alloc] initWithMasterPassword:_masterPassword failureBlock:^{ NSLog(@"failed to login"); } successBlock:^{ NSLog(@"successfully logged in"); }];
The rest is handled for you behind the scenes.