From 3b223848e2edd70a63432cbc8426160ceb889a51 Mon Sep 17 00:00:00 2001 From: WELCommand Date: Mon, 21 Nov 2016 12:12:08 +0800 Subject: [PATCH] fix rotate screen blackmask frame dislocation and alertView center dislocation --- Classes/PXAlertView.m | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/Classes/PXAlertView.m b/Classes/PXAlertView.m index 08a7d17..f05f4ff 100644 --- a/Classes/PXAlertView.m +++ b/Classes/PXAlertView.m @@ -264,14 +264,23 @@ - (void)keyboardWillHide:(NSNotification*)notification - (CGRect)frameForOrientation { - UIWindow *window = [[UIApplication sharedApplication].windows count] > 0 ? [[UIApplication sharedApplication].windows objectAtIndex:0] : nil; - if (!window) - window = [UIApplication sharedApplication].keyWindow; - if([[window subviews] count] > 0) - { - return [[[window subviews] objectAtIndex:0] bounds]; - } - return [[self windowWithLevel:UIWindowLevelNormal] bounds]; + +#ifdef __IPHONE_8_0 + return [UIScreen mainScreen].bounds; +#else + + UIWindow *window = [[UIApplication sharedApplication].windows count] > 0 ? [[UIApplication sharedApplication].windows objectAtIndex:0] : nil; + if (!window) + window = [UIApplication sharedApplication].keyWindow; + if([[window subviews] count] > 0) + { + return [[[window subviews] objectAtIndex:0] bounds]; + } + return [[self windowWithLevel:UIWindowLevelNormal] bounds]; + +#endif + + } - (CGRect)adjustLabelFrameHeight:(UILabel *)label