From 548afd9cbec17f210b902d4c592d1419da58a7c1 Mon Sep 17 00:00:00 2001 From: Grzegorz Adam Hankiewicz Date: Sat, 8 Oct 2011 00:56:46 +0200 Subject: [PATCH] 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. --- DCIntrospect/DCStatusBarOverlay.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/DCIntrospect/DCStatusBarOverlay.m b/DCIntrospect/DCStatusBarOverlay.m index c87dadb..7be771e 100644 --- a/DCIntrospect/DCStatusBarOverlay.m +++ b/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];