Permalink
Browse files

Fixes size for non portrait launch apps. Refs #26.

The statusBarFrame can't be trusted to initialize the status bar overlay
properly due to transformed rect coordinates. So we detect the
orientation and use the longest size with a predefined height.
  • Loading branch information...
1 parent e7a6055 commit 548afd9cbec17f210b902d4c592d1419da58a7c1 Grzegorz Adam Hankiewicz committed Oct 7, 2011
Showing with 9 additions and 2 deletions.
  1. +9 −2 DCIntrospect/DCStatusBarOverlay.m
@@ -25,8 +25,15 @@ - (id)init
{
if ((self = [super initWithFrame:CGRectZero]))
{
- self.windowLevel = UIWindowLevelStatusBar + 1.0f;
- self.frame = [[UIApplication sharedApplication] statusBarFrame];
+ self.windowLevel = UIWindowLevelStatusBar + 1.0f;
+ UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
+ CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width;
+ CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height;
+ const CGFloat bar_size = 20;
+ if (UIInterfaceOrientationIsLandscape(orientation))
+ self.frame = CGRectMake(0, 0, screenHeight, bar_size);
+ else
+ self.frame = CGRectMake(0, 0, screenWidth, bar_size);
self.backgroundColor = [UIColor blackColor];
UIImageView *backgroundImageView = [[UIImageView alloc] initWithFrame:self.frame];

0 comments on commit 548afd9

Please sign in to comment.