Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorv.mikhaylenko <v.mikhaylenko@corp.mail.ru>2015-07-17 16:01:47 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:56:46 +0300
commitc309f82da9e76afc1bdbd368c158ad7f1d9d6089 (patch)
treec9ee4e0f8a4e4528775e4331f3e2eb1dc370bd29 /iphone/Maps/Classes/CustomAlert
parent8910a60b6f3d69542ce5f31c2d01daea2e0e3acb (diff)
[ios] Fixed bug with alert rotation in iOS7.
Diffstat (limited to 'iphone/Maps/Classes/CustomAlert')
-rw-r--r--iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm27
1 files changed, 26 insertions, 1 deletions
diff --git a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm
index ab0b9ed214..1021f7eb2b 100644
--- a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm
+++ b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm
@@ -32,6 +32,13 @@ static NSString * const kAlertControllerNibIdentifier = @"MWMAlertViewController
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
MWMAlert * alert = [self.view.subviews firstObject];
+ if (isIOSVersionLessThan(8) && [alert respondsToSelector:@selector(setTransform:)])
+ {
+ [UIView animateWithDuration:duration animations:^
+ {
+ alert.transform = [self rotationForOrientation:toInterfaceOrientation];
+ }];
+ }
if ([alert respondsToSelector:@selector(willRotateToInterfaceOrientation:)])
[alert willRotateToInterfaceOrientation:toInterfaceOrientation];
}
@@ -56,7 +63,7 @@ static NSString * const kAlertControllerNibIdentifier = @"MWMAlertViewController
}
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:title message:nil preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction * cancelAction = [UIAlertAction actionWithTitle:cancel style:UIAlertActionStyleCancel handler:nil];
- UIAlertAction * openSettingsAction = [UIAlertAction actionWithTitle:openSettings style:UIAlertActionStyleDefault handler:^(UIAlertAction *action)
+ UIAlertAction * openSettingsAction = [UIAlertAction actionWithTitle:openSettings style:UIAlertActionStyleDefault handler:^(UIAlertAction * action)
{
[self openSettings];
}];
@@ -134,6 +141,8 @@ static NSString * const kAlertControllerNibIdentifier = @"MWMAlertViewController
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];
[self.view addSubview:alert];
alert.bounds = self.view.bounds;
alert.center = self.view.center;
@@ -170,6 +179,22 @@ static NSString * const kAlertControllerNibIdentifier = @"MWMAlertViewController
[a openURL:url];
}
+- (CGAffineTransform)rotationForOrientation:(UIInterfaceOrientation)orientation
+{
+ switch (orientation)
+ {
+ case UIInterfaceOrientationLandscapeLeft:
+ return CGAffineTransformMakeRotation(-M_PI_2);
+ case UIInterfaceOrientationLandscapeRight:
+ return CGAffineTransformMakeRotation(M_PI_2);
+ case UIInterfaceOrientationPortraitUpsideDown:
+ return CGAffineTransformMakeRotation(M_PI);
+ case UIInterfaceOrientationUnknown:
+ case UIInterfaceOrientationPortrait:
+ return CGAffineTransformIdentity;
+ }
+}
+
#pragma mark - UIAlertViewDelegate
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex