Created
March 23, 2015 01:37
-
-
Save goldcoast/5dbaadaf308c8dcd33e8 to your computer and use it in GitHub Desktop.
手势密码后显示控制
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)applicationDidBecomeActive:(UIApplication *)application | |
{ | |
NSDate* end = [NSDate date]; | |
NSTimeInterval distanceBetweenDates = [self.current timeIntervalSinceDate:end]; | |
//if time is more than LOCK_DISPLAY_TIME(30s) | |
if (fabs(distanceBetweenDates) > LOCK_DISPLAY_TIME) | |
{ | |
UIViewController *root = [UIApplication sharedApplication].keyWindow.rootViewController; | |
while (root.presentedViewController) | |
{ | |
root = root.presentedViewController; | |
} | |
//check if is the sepcific view controller | |
if (![root isKindOfClass:[GuideViewController class]] | |
&& ![root isKindOfClass:[LoginController class]] | |
&& ![root isKindOfClass:[SecurityCodeController class]] | |
&& ![root isKindOfClass:[GesturePasswordController class]] | |
) | |
{ | |
//这里是因为有个弹出窗比较特殊需过滤掉 | |
NSArray *windows = [UIApplication sharedApplication].windows; | |
for (Dialog * dialog in windows) | |
{ | |
if ([dialog isKindOfClass:[Dialog class]]) | |
{ | |
[dialog hide]; | |
} | |
} | |
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; | |
GesturePasswordController *controller = [storyboard instantiateViewControllerWithIdentifier:GESTURE_STORY_BORD]; | |
controller.isLogin = YES; | |
controller.backToFront = YES; | |
[root presentViewController:controller animated:YES completion:nil]; | |
} | |
} | |
self.current = [NSDate date]; | |
} | |
//在GesturePasswordController.m中上面最终会调用下面这个方法 | |
- (void)display | |
{ | |
if (_backToFront) | |
{ | |
//显示关闭前的界面 | |
[self dismissViewControllerAnimated:YES completion:nil]; | |
} | |
else if (_hasSecurity) | |
{ // | |
[self performSegueWithIdentifier:@"GestureToHome" sender:self]; | |
} | |
else | |
{ | |
[self performSegueWithIdentifier:@"GestureToSecurity" sender:self]; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment