Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix padding unnecessary status padding #173

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 7 additions & 3 deletions TSMessages/Classes/TSMessage.m
Expand Up @@ -207,31 +207,35 @@ - (void)fadeInCurrentNotification
else
currentNavigationController = (UINavigationController *)currentView.viewController.parentViewController;

BOOL isCurrentNavigationAtTop = currentNavigationController.view.frame.origin.y > 0;

BOOL isViewIsUnderStatusBar = [[[currentNavigationController childViewControllers] firstObject] wantsFullScreenLayout];
if (!isViewIsUnderStatusBar && currentNavigationController.parentViewController == nil) {
isViewIsUnderStatusBar = ![TSMessage isNavigationBarInNavigationControllerHidden:currentNavigationController]; // strange but true
}

if (![TSMessage isNavigationBarInNavigationControllerHidden:currentNavigationController])
{
[currentNavigationController.view insertSubview:currentView
belowSubview:[currentNavigationController navigationBar]];
verticalOffset = [currentNavigationController navigationBar].bounds.size.height;
if ([TSMessage iOS7StyleEnabled] || isViewIsUnderStatusBar) {
if (([TSMessage iOS7StyleEnabled] || isViewIsUnderStatusBar) && !isCurrentNavigationAtTop) {
addStatusBarHeightToVerticalOffset();
}
}
else
{
[currentView.viewController.view addSubview:currentView];
if ([TSMessage iOS7StyleEnabled] || isViewIsUnderStatusBar) {
if (([TSMessage iOS7StyleEnabled] || isViewIsUnderStatusBar) && !isCurrentNavigationAtTop) {
addStatusBarHeightToVerticalOffset();
}
}
}
else
{
[currentView.viewController.view addSubview:currentView];
if ([TSMessage iOS7StyleEnabled]) {
BOOL isCurrentViewAtTop = [currentView.viewController.view convertPoint:currentView.frame.origin toView:[UIApplication sharedApplication].keyWindow].y == 0;
if ([TSMessage iOS7StyleEnabled] && !isCurrentViewAtTop) {
addStatusBarHeightToVerticalOffset();
}
}
Expand Down