Skip to content

Commit

Permalink
Merge pull request mapbox#15 from datalogics-kam/fix-iOS7-status-bar-…
Browse files Browse the repository at this point in the history
…hiding

fix status bar hiding in iOS 7+
  • Loading branch information
incanus committed Aug 12, 2014
2 parents 17b5ef4 + 68ac00d commit b8bf8ff
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion MBFingerTipWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ @interface MBFingerTipView : UIImageView

#pragma mark -

@interface MBFingerTipOverlayWindow : UIWindow
@end

#pragma mark -

@interface MBFingerTipWindow ()

@property (nonatomic, strong) UIWindow *overlayWindow;
Expand Down Expand Up @@ -104,7 +109,7 @@ - (UIWindow *)overlayWindow
{
if ( ! _overlayWindow)
{
_overlayWindow = [[UIWindow alloc] initWithFrame:self.frame];
_overlayWindow = [[MBFingerTipOverlayWindow alloc] initWithFrame:self.frame];

_overlayWindow.userInteractionEnabled = NO;
_overlayWindow.windowLevel = UIWindowLevelStatusBar;
Expand Down Expand Up @@ -359,3 +364,26 @@ - (BOOL)shouldAutomaticallyRemoveFingerTipForTouch:(UITouch *)touch;
@implementation MBFingerTipView

@end

#pragma mark -

@implementation MBFingerTipOverlayWindow

// UIKit tries to get the rootViewController from the overlay window.
// Instead, try to find the rootViewController on some other
// application window.
// Fixes problems with status bar hiding, because it considers the
// overlay window a candidate for controlling the status bar.
- (UIViewController *)rootViewController {
for (UIWindow *window in [[UIApplication sharedApplication] windows]) {
if (self == window)
continue;

UIViewController *realRootViewController = window.rootViewController;
if (realRootViewController != nil)
return realRootViewController;
}
return [super rootViewController];
}

@end

0 comments on commit b8bf8ff

Please sign in to comment.