diff --git a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm index f0df31c4e5..c1d1d93737 100644 --- a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm +++ b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm @@ -36,7 +36,7 @@ static NSString * const kAlertControllerNibIdentifier = @"MWMAlertViewController { [UIView animateWithDuration:duration animations:^ { - alert.transform = [self rotationForOrientation:toInterfaceOrientation]; + alert.transform = rotation(toInterfaceOrientation); }]; } if ([alert respondsToSelector:@selector(willRotateToInterfaceOrientation:)]) @@ -127,19 +127,23 @@ static NSString * const kAlertControllerNibIdentifier = @"MWMAlertViewController - (void)displayAlert:(MWMAlert *)alert { + BOOL const iOS7 = isIOSVersionLessThan(8); alert.alertController = self; [self.ownerViewController addChildViewController:self]; self.view.alpha = 0.; alert.alpha = 0.; - CGFloat const scale = 1.1; - alert.transform = CGAffineTransformMakeScale(scale, scale); + if (!iOS7) + { + CGFloat const scale = 1.1; + alert.transform = CGAffineTransformMakeScale(scale, scale); + } self.view.center = self.ownerViewController.view.center; [self.ownerViewController.view addSubview:self.view]; UIWindow * window = [[[UIApplication sharedApplication] delegate] window]; [window addSubview:self.view]; self.view.frame = window.bounds; - if (isIOSVersionLessThan(8)) - alert.transform = [self rotationForOrientation:self.ownerViewController.interfaceOrientation]; + if (iOS7) + alert.transform = rotation(self.ownerViewController.interfaceOrientation); [self.view addSubview:alert]; alert.bounds = self.view.bounds; alert.center = self.view.center; @@ -147,7 +151,8 @@ static NSString * const kAlertControllerNibIdentifier = @"MWMAlertViewController { self.view.alpha = 1.; alert.alpha = 1.; - alert.transform = CGAffineTransformIdentity; + if (!iOS7) + alert.transform = CGAffineTransformIdentity; }]; } @@ -176,7 +181,7 @@ static NSString * const kAlertControllerNibIdentifier = @"MWMAlertViewController [a openURL:url]; } -- (CGAffineTransform)rotationForOrientation:(UIInterfaceOrientation)orientation +CGAffineTransform rotation(UIInterfaceOrientation orientation) { switch (orientation) { diff --git a/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.mm b/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.mm index b0ae3f54a0..23466150de 100644 --- a/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.mm +++ b/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.mm @@ -6,6 +6,7 @@ // Copyright (c) 2015 MapsWithMe. All rights reserved. // +#import "Common.h" #import "MWMAlertViewController.h" #import "MWMRoutingDisclaimerAlert.h" #import "UIColor+MapsMeColor.h" @@ -25,12 +26,25 @@ static CGFloat const kMinimumOffset = 20.; + (instancetype)alertWithInitialOrientation:(UIInterfaceOrientation)orientation { - MWMRoutingDisclaimerAlert * alert = [[[NSBundle mainBundle] loadNibNamed:[MWMRoutingDisclaimerAlert className] owner:nil options:nil] firstObject]; - NSString * message = [NSString stringWithFormat:@"%@\n\n%@\n\n%@\n\n%@", L(@"dialog_routing_disclaimer_priority"), L(@"dialog_routing_disclaimer_precision"), L(@"dialog_routing_disclaimer_recommendations"),L(@"dialog_routing_disclaimer_beware")]; - alert.textView.attributedText = [[NSAttributedString alloc] initWithString:message attributes:@{NSFontAttributeName : UIFont.regular14, NSForegroundColorAttributeName : UIColor.blackSecondaryText}]; + MWMRoutingDisclaimerAlert * alert = [[[NSBundle mainBundle] loadNibNamed:[MWMRoutingDisclaimerAlert className] + owner:nil + options:nil] firstObject]; + NSString * message = [NSString stringWithFormat:@"%@\n\n%@\n\n%@\n\n%@", + L(@"dialog_routing_disclaimer_priority"), + L(@"dialog_routing_disclaimer_precision"), + L(@"dialog_routing_disclaimer_recommendations"), + L(@"dialog_routing_disclaimer_beware")]; + alert.textView.attributedText = [[NSAttributedString alloc] initWithString:message + attributes:@{NSFontAttributeName : UIFont.regular14, + NSForegroundColorAttributeName : UIColor.blackSecondaryText}]; [alert.textView sizeToFit]; UIWindow * window = UIApplication.sharedApplication.keyWindow; - [alert invalidateTextViewHeight:alert.textView.height withHeight:UIInterfaceOrientationIsLandscape(orientation) ? window.width : window.height]; + CGFloat height; + if (isIOSVersionLessThan(8)) + height = UIInterfaceOrientationIsLandscape(orientation) ? window.width : window.height; + else + height = window.height; + [alert invalidateTextViewHeight:alert.textView.height withHeight:height]; return alert; } diff --git a/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.xib b/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.xib index 372d573f9e..5cb41cf618 100644 --- a/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.xib +++ b/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.xib @@ -35,7 +35,7 @@ - +