Skip to content

Commit cc6d751

Browse files
committed
fix statusBar appearance in iOS7
1 parent 2f04436 commit cc6d751

File tree

5 files changed

+17
-3
lines changed

5 files changed

+17
-3
lines changed

CXAlertView/CXAlertView.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,10 @@ - (void)show
258258
CXAlertViewController *viewController = [[CXAlertViewController alloc] initWithNibName:nil bundle:nil];
259259
viewController.alertView = self;
260260

261+
if ([self.oldKeyWindow.rootViewController respondsToSelector:@selector(prefersStatusBarHidden)]) {
262+
viewController.rootViewControllerPrefersStatusBarHidden = self.oldKeyWindow.rootViewController.prefersStatusBarHidden;
263+
}
264+
261265
if (!self.alertWindow) {
262266
UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
263267
window.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

CXAlertView/CXAlertViewController.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@
1313

1414
@property (nonatomic, strong) CXAlertView *alertView;
1515

16+
@property (nonatomic, assign) BOOL rootViewControllerPrefersStatusBarHidden;
17+
1618
@end

CXAlertView/CXAlertViewController.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,8 @@ - (BOOL)shouldAutorotate
6464
{
6565
return YES;
6666
}
67-
67+
- (BOOL)prefersStatusBarHidden
68+
{
69+
return _rootViewControllerPrefersStatusBarHidden;
70+
}
6871
@end

CXAlertViewDemo/CXAlertViewDemo/CXAlertViewDemo-Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>1.0.0</string>
20+
<string>1.0.1</string>
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleVersion</key>
24-
<string>1.0.0</string>
24+
<string>1.0.1</string>
2525
<key>LSRequiresIPhoneOS</key>
2626
<true/>
2727
<key>UIRequiredDeviceCapabilities</key>

CXAlertViewDemo/CXAlertViewDemo/CXViewController.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ - (void)viewDidAppear:(BOOL)animated
110110
[alertView show];
111111
}
112112

113+
- (BOOL)prefersStatusBarHidden
114+
{
115+
return YES;
116+
}
117+
113118
- (IBAction)showSquenceAlertView:(id)sender
114119
{
115120
// This is a demo for poping up two alertview.

0 commit comments

Comments
 (0)