Skip to content

Commit

Permalink
Fixed frame on iPad when in iPhone emulation mode - thanks to anystone
Browse files Browse the repository at this point in the history
  • Loading branch information
myell0w committed Jan 19, 2011
1 parent 4d932f1 commit 5a980fa
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions MTStatusBarOverlay.m
Expand Up @@ -28,14 +28,14 @@
#pragma mark Defines
//===========================================================

// macro for checking if we are on the iPad
#define IsIPad UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad
// the height of the status bar
#define kStatusBarHeight 20
// width of the screen in portrait-orientation
#define kScreenWidth [UIScreen mainScreen].bounds.size.width
// height of the screen in portrait-orientation
#define kScreenHeight [UIScreen mainScreen].bounds.size.height
// macro for checking if we are on the iPad (but not in the iPhone-mode on an iPad)
#define IsIPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) && (kScreenWidth > 320)



Expand Down Expand Up @@ -356,6 +356,9 @@ - (id)initWithFrame:(CGRect)frame {

// only use height of 20px even is status bar is doubled
statusBarFrame.size.height = statusBarFrame.size.height == 2*kStatusBarHeight ? kStatusBarHeight : statusBarFrame.size.height;
// if we are on the iPad but in iPhone-Mode (non-universal-app) correct the width
if( statusBarFrame.size.width > kScreenWidth )
statusBarFrame.size.width = kScreenWidth;
// must be done with width and height because of a possible rotation
// statusBarFrame.size.width = statusBarFrame.size.width == 2*kStatusBarHeight ? kStatusBarHeight : statusBarFrame.size.width;

Expand Down Expand Up @@ -592,9 +595,9 @@ - (void)postImmediateMessage:(NSString *)message type:(MTMessageType)messageType
[clearedMessages addObject:messageDictionary];
}
}

[self.messageQueue removeObjectsInArray:clearedMessages];

// call delegate
if (self.delegate != nil && [self.delegate respondsToSelector:@selector(statusBarOverlayDidHide)] && clearedMessages.count > 0) {
[self.delegate statusBarOverlayDidClearMessageQueue:clearedMessages];
Expand Down Expand Up @@ -662,7 +665,7 @@ - (void)showNextMessage {
[self setStatusBarBackgroundForStyle:statusBarStyle];
[self setColorSchemeForStatusBarStyle:statusBarStyle];
[self updateUIForMessageType:messageType duration:duration];

// if status bar is currently hidden, show it
if (self.reallyHidden) {
// set text of visible status label
Expand Down

0 comments on commit 5a980fa

Please sign in to comment.