From e072344bdb78783a58124896a056bd45a864c5a1 Mon Sep 17 00:00:00 2001 From: squarezw Date: Sun, 14 Feb 2016 20:46:59 +0800 Subject: [PATCH] Detecting whether the view is under status bar on iOS7+ --- Pod/Classes/TSMessage.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Pod/Classes/TSMessage.m b/Pod/Classes/TSMessage.m index 02deac66..4261e518 100755 --- a/Pod/Classes/TSMessage.m +++ b/Pod/Classes/TSMessage.m @@ -208,8 +208,13 @@ - (void)fadeInCurrentNotification currentNavigationController = (UINavigationController *)currentView.viewController; else currentNavigationController = (UINavigationController *)currentView.viewController.parentViewController; - + +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 + UIViewController *deteVC = [[currentNavigationController childViewControllers] firstObject]; + BOOL isViewIsUnderStatusBar = [deteVC edgesForExtendedLayout] == UIRectEdgeAll || [deteVC extendedLayoutIncludesOpaqueBars] == YES; +#else BOOL isViewIsUnderStatusBar = [[[currentNavigationController childViewControllers] firstObject] wantsFullScreenLayout]; +#endif if (!isViewIsUnderStatusBar && currentNavigationController.parentViewController == nil) { isViewIsUnderStatusBar = ![TSMessage isNavigationBarInNavigationControllerHidden:currentNavigationController]; // strange but true }