I am working an app where lock option is included.My app starts with passcode screen.If I enter correct code then it navigates to next screen.If I dont use the app for long time
I have developed same type of apps, where I have implemented this things, For this I made a one Class like this
@interface CommonUIClass:NSObject
+(void)setCurrentViewController:(id)controller;
+(void)openPassWordProtectedScreen;
@end
And
@implementation CommonUIClass
static id currentViewControllerObj;
+(void)setCurrentViewController:(id)controller{
currentViewControllerObj = controller;
}
+(void)openPassWordProtectedScreen{
PROTECTED_CONTROLLER *view = [[PROTECTED_CONTROLLER alloc]init];
if ([currentViewControllerObj respondsToSelector:@selector(presentModalViewController:animated:)]) {
[currentViewControllerObj presentModalViewController:patternLock animated:NO];
}
}
@end
Just import this class to every ViewController And put this code to
-(void)viewWillApear{
[CommonUIClass setCurrentViewController:self];
[super viewWillApear];
}
And When Application Goes in Background
-(void)applicationWillResignActive:(UIApplication *)application{
[CommonUIClass openPassWordProtectedScreen];
}
Thanks..