From 50290d83deab9db09837ff4ca2cb8dc285c0e8ab Mon Sep 17 00:00:00 2001 From: EddyVerbruggen Date: Fri, 19 Jun 2015 12:28:29 +0200 Subject: [PATCH] #37 Support landscape mode on iOS 7 --- plugin.xml | 2 +- src/ios/Toast+UIView.m | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/plugin.xml b/plugin.xml index b18d4e5..5a543bb 100755 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="2.1.1"> Toast diff --git a/src/ios/Toast+UIView.m b/src/ios/Toast+UIView.m index 56fd119..753683a 100644 --- a/src/ios/Toast+UIView.m +++ b/src/ios/Toast+UIView.m @@ -114,9 +114,14 @@ static UIView *prevToast = NULL; toast.exclusiveTouch = YES; } - // make sure that if InAppBrowser is active, we're still showing Toasts on top of it - [self.superview.superview addSubview:toast]; - + if ([[[UIDevice currentDevice] systemVersion] compare:@"8.0" options:NSNumericSearch] != NSOrderedAscending) { + // on iOS8 when InAppBrowser is active, the Toast is below it, + [self.superview.superview addSubview:toast]; + } else { + // ..on iOS7 however with this fix on landscape the Toast isn't rotated automatically + [self.superview addSubview:toast]; + } + [UIView animateWithDuration:CSToastFadeDuration delay:0.0 options:(UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionAllowUserInteraction) @@ -156,7 +161,7 @@ static UIView *prevToast = NULL; - (void)handleToastTapped:(UITapGestureRecognizer *)recognizer { NSTimer *timer = (NSTimer *)objc_getAssociatedObject(self, &CSToastTimerKey); [timer invalidate]; - + [self hideToast:recognizer.view]; } @@ -247,7 +252,10 @@ static UIView *prevToast = NULL; return CGSizeMake(ceilf(boundingRect.size.width), ceilf(boundingRect.size.height)); } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" return [string sizeWithFont:font constrainedToSize:constrainedSize lineBreakMode:lineBreakMode]; +#pragma clang diagnostic pop } - (UIView *)viewForMessage:(NSString *)message title:(NSString *)title image:(UIImage *)image {