@@ -1010,60 +1010,10 @@ - (void)showLockscreenWithoutAnimation {
10101010}
10111011
10121012- (void )showLockScreenWithAnimation : (BOOL )animated withLogout : (BOOL )hasLogout andLogoutTitle : (NSString *)logoutTitle {
1013- [self _prepareAsLockScreen ];
1014-
1015- // In case the user leaves the app while the lockscreen is already active.
1016- if (_isCurrentlyOnScreen) { return ; }
1017- _isCurrentlyOnScreen = YES ;
1018-
1019- [LTHMainWindow addSubview: self .view];
1020-
1021- // All this hassle because a view added to UIWindow does not rotate automatically
1022- // and if we would have added the view anywhere else, it wouldn't display properly
1023- // (having a modal on screen when the user leaves the app, for example).
1024- [self rotateAccordingToStatusBarOrientationAndSupportedOrientations ];
1025- CGPoint newCenter;
1026- [self statusBarFrameOrOrientationChanged: nil ];
1027- if (LTHiOS8) {
1028- self.view .center = CGPointMake (self.view .center .x , self.view .center .y * -1 .f );
1029- newCenter = CGPointMake (LTHMainWindow.center .x ,
1030- LTHMainWindow.center .y + self.navigationController .navigationBar .frame .size .height / 2 );
1031- }
1032- else {
1033- if ([UIApplication sharedApplication ].statusBarOrientation == UIInterfaceOrientationLandscapeLeft) {
1034- self.view .center = CGPointMake (self.view .center .x * -1 .f , self.view .center .y );
1035- newCenter = CGPointMake (LTHMainWindow.center .x - self.navigationController .navigationBar .frame .size .height / 2 ,
1036- LTHMainWindow.center .y );
1037- }
1038- else if ([UIApplication sharedApplication ].statusBarOrientation == UIInterfaceOrientationLandscapeRight) {
1039- self.view .center = CGPointMake (self.view .center .x * 2 .f , self.view .center .y );
1040- newCenter = CGPointMake (LTHMainWindow.center .x + self.navigationController .navigationBar .frame .size .height / 2 ,
1041- LTHMainWindow.center .y );
1042- }
1043- else if ([UIApplication sharedApplication ].statusBarOrientation == UIInterfaceOrientationPortrait) {
1044- self.view .center = CGPointMake (self.view .center .x , self.view .center .y * -1 .f );
1045- newCenter = CGPointMake (LTHMainWindow.center .x ,
1046- LTHMainWindow.center .y - self.navigationController .navigationBar .frame .size .height / 2 );
1047- }
1048- else {
1049- self.view .center = CGPointMake (self.view .center .x , self.view .center .y * 2 .f );
1050- newCenter = CGPointMake (LTHMainWindow.center .x ,
1051- LTHMainWindow.center .y + self.navigationController .navigationBar .frame .size .height / 2 );
1052- }
1053- }
1054-
1055- [UIView animateWithDuration: animated ? _lockAnimationDuration : 0 animations: ^{
1056- self.view .center = newCenter;
1057- }];
1058-
1059- // Add nav bar & logout button if specified
1060- if (hasLogout) {
1061- _isUsingNavBar = hasLogout;
1062- [self _setupNavBarWithLogoutTitle: logoutTitle];
1063- }
1013+ [self showLockScreenIntoSuperview: LTHMainWindow withAnimation: animated withLogout: hasLogout andLogoutTitle: logoutTitle];
10641014}
10651015
1066- - (void )showLockScreenIntoSuperview : (UIView *)superview WithAnimation : (BOOL )animated withLogout : (BOOL )hasLogout andLogoutTitle : (NSString *)logoutTitle {
1016+ - (void )showLockScreenIntoSuperview : (UIView *)superview withAnimation : (BOOL )animated withLogout : (BOOL )hasLogout andLogoutTitle : (NSString *)logoutTitle {
10671017 [self _prepareAsLockScreen ];
10681018
10691019 // In case the user leaves the app while the lockscreen is already active.
@@ -1076,7 +1026,7 @@ - (void)showLockScreenIntoSuperview:(UIView *)superview WithAnimation:(BOOL)anim
10761026 // and if we would have added the view anywhere else, it wouldn't display properly
10771027 // (having a modal on screen when the user leaves the app, for example).
10781028 [self rotateAccordingToStatusBarOrientationAndSupportedOrientations ];
1079- CGPoint superviewCenter = CGPointMake (superview.frame . size . width / 2 , superview.frame . size . height / 2 );
1029+ CGPoint superviewCenter = CGPointMake (superview.center . x , superview.center . y );
10801030 CGPoint newCenter;
10811031 [self statusBarFrameOrOrientationChanged: nil ];
10821032 if (LTHiOS8) {
0 commit comments