From adbf151a030852fe9c70f4f769634f2cc25c2f5a Mon Sep 17 00:00:00 2001 From: Anthony Lobianco Date: Wed, 30 Oct 2013 09:15:28 -0400 Subject: [PATCH] check base SDK version before using iOS7 code. fixes #17 --- ALAlertBanner/ALAlertBanner.m | 2 ++ ALAlertBanner/ALAlertBannerManager.m | 2 ++ 2 files changed, 4 insertions(+) diff --git a/ALAlertBanner/ALAlertBanner.m b/ALAlertBanner/ALAlertBanner.m index a8c6c44..caf01ad 100755 --- a/ALAlertBanner/ALAlertBanner.m +++ b/ALAlertBanner/ALAlertBanner.m @@ -537,6 +537,7 @@ - (void)setInitialLayout { case ALAlertBannerPositionTop: initialYCoord = -heightForSelf; if (isSuperviewKindOfWindow) initialYCoord += kStatusBarHeight; +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 if (AL_IOS_7_OR_GREATER) { id nextResponder = [self nextAvailableViewController:self]; if (nextResponder) { @@ -546,6 +547,7 @@ - (void)setInitialLayout { } } } +#endif break; case ALAlertBannerPositionBottom: initialYCoord = superview.bounds.size.height; diff --git a/ALAlertBanner/ALAlertBannerManager.m b/ALAlertBanner/ALAlertBannerManager.m index eabc040..7c65186 100755 --- a/ALAlertBanner/ALAlertBannerManager.m +++ b/ALAlertBanner/ALAlertBannerManager.m @@ -282,6 +282,7 @@ - (void)didRotate:(NSNotification *)note { for (UIView *view in self.bannerViews) { NSArray *topBanners = [view.alertBanners filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF.position == %i", ALAlertBannerPositionTop]]; CGFloat topYCoord = 0.f; +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 if (AL_IOS_7_OR_GREATER && topBanners.count > 0) { ALAlertBanner *firstBanner = (ALAlertBanner *)[topBanners objectAtIndex:0]; id nextResponder = [firstBanner nextAvailableViewController:firstBanner]; @@ -292,6 +293,7 @@ - (void)didRotate:(NSNotification *)note { } } } +#endif for (ALAlertBanner *alertBanner in [topBanners reverseObjectEnumerator]) { [alertBanner updateSizeAndSubviewsAnimated:YES]; [alertBanner updatePositionAfterRotationWithY:topYCoord animated:YES];