Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

'Ignoring status bar height when controller is presented modally' con… #176

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 3 additions & 8 deletions TLYShyNavBar/ShyControllers/TLYShyStatusBarController.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ static inline CGFloat AACStatusBarHeight(UIViewController *viewController)
{
return 0.f;
}

// Modal views do not overlap the status bar, so no allowance need be made for it
if (viewController.presentingViewController != nil)
{
return 0.f;
}

CGSize statusBarSize = [UIApplication sharedApplication].statusBarFrame.size;
CGFloat statusBarHeight = MIN(statusBarSize.width, statusBarSize.height);
Expand All @@ -46,14 +40,15 @@ @implementation TLYShyStatusBarController

- (CGFloat)_statusBarHeight
{
CGFloat statusBarDefaultHeight = [UIApplication sharedApplication].statusBarFrame.size.height;
CGFloat statusBarHeight = AACStatusBarHeight(self.viewController);
/* The standard status bar is 20 pixels. The navigation bar extends 20 pixels up so it is overlapped by the status bar.
* When there is a larger than 20 pixel status bar (e.g. a phone call is in progress or GPS is active), the center needs
* to shift up 20 pixels to avoid this 'dead space' being visible above the usual nav bar.
*/
if (statusBarHeight > 20)
if (statusBarHeight > statusBarDefaultHeight)
{
statusBarHeight -= 20;
statusBarHeight -= statusBarDefaultHeight;
}

return statusBarHeight;
Expand Down
2 changes: 2 additions & 0 deletions TLYShyNavBar/TLYShyNavBarManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
*/
@interface TLYShyNavBarManager : NSObject

@property (nonatomic) BOOL disableLayoutViews;

/* The view controller that is part of the navigation stack
* IMPORTANT: Must have access to navigationController
*/
Expand Down
2 changes: 1 addition & 1 deletion TLYShyNavBar/TLYShyNavBarManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ - (void)prepareForDisplay

- (void)layoutViews
{
if (fabs([self.scrollViewController updateLayoutIfNeeded]) > FLT_EPSILON)
if (!self.disableLayoutViews && fabs([self.scrollViewController updateLayoutIfNeeded]) > FLT_EPSILON)
{
[self.navBarController expand];
[self.extensionViewContainer.superview bringSubviewToFront:self.extensionViewContainer];
Expand Down