I have navigation-based application with first RootViewController.
I wanna to protect it with password like lock screen.
I’ve already code of password checking.
But I don’t know how to
1) Insert my CheckPasswordView first before RootViewController.
2) Require to enter the password every time my application reopens from suspend.
Update:
- (void)applicationDidBecomeActive:(UIApplication *)application {
/*
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
*/
CheckPasswordViewController *vc = [[CheckPasswordViewController alloc]
initWithNibName:@"CheckPasswordViewController" bundle:nil];
vc.title = @"Enter password";
[self.navigationController pushViewController:vc animated:YES];
[vc release];
}
You need to use the UIApplicationDelegate’s
applicationDidBecomeActivemessage. In that delegate (function) you can put code to make yourCheckPasswordViewactive and ask user for password before resuming the application. From the documentation:There are other methods in this delegate you can take a look at to implement what you need.