Merge pull request #3228 from jianhan-he/master

[iOS] adapt modal and picker modules for iPad
diff --git a/ios/sdk/WeexSDK/Sources/Module/WXModalUIModule.m b/ios/sdk/WeexSDK/Sources/Module/WXModalUIModule.m
index bdca09f..6e6f353 100644
--- a/ios/sdk/WeexSDK/Sources/Module/WXModalUIModule.m
+++ b/ios/sdk/WeexSDK/Sources/Module/WXModalUIModule.m
@@ -158,34 +158,35 @@
     CGSize windowSize = window.frame.size;
     if ([WXUtility enableAdaptiveLayout]) {
         windowSize = self.weexInstance.viewController.view.frame.size;
-    }
-    
-    // adjust to screen orientation
-    UIInterfaceOrientation orientation = (UIInterfaceOrientation)[[UIApplication sharedApplication] statusBarOrientation];
-    switch (orientation) {
-        case UIDeviceOrientationPortrait: {
-            point = CGPointMake(windowSize.width/2, windowSize.height/2);
-            break;
+        point = window.center;
+    } else {
+        // adjust to screen orientation
+        UIInterfaceOrientation orientation = (UIInterfaceOrientation)[[UIApplication sharedApplication] statusBarOrientation];
+        switch (orientation) {
+            case UIDeviceOrientationPortrait: {
+                point = CGPointMake(windowSize.width/2, windowSize.height/2);
+                break;
+            }
+            case UIDeviceOrientationPortraitUpsideDown: {
+                toastView.transform = CGAffineTransformMakeRotation(M_PI);
+                float width = windowSize.width;
+                float height = windowSize.height;
+                point = CGPointMake(width/2, height/2);
+                break;
+            }
+            case UIDeviceOrientationLandscapeLeft: {
+                toastView.transform = CGAffineTransformMakeRotation(M_PI/2); //rotation in radians
+                point = CGPointMake(windowSize.width/2, windowSize.height/2);
+                break;
+            }
+            case UIDeviceOrientationLandscapeRight: {
+                toastView.transform = CGAffineTransformMakeRotation(-M_PI/2);
+                point = CGPointMake(windowSize.width/2, windowSize.height/2);
+                break;
+            }
+            default:
+                break;
         }
-        case UIDeviceOrientationPortraitUpsideDown: {
-            toastView.transform = CGAffineTransformMakeRotation(M_PI);
-            float width = windowSize.width;
-            float height = windowSize.height;
-            point = CGPointMake(width/2, height/2);
-            break;
-        }
-        case UIDeviceOrientationLandscapeLeft: {
-            toastView.transform = CGAffineTransformMakeRotation(M_PI/2); //rotation in radians
-            point = CGPointMake(windowSize.width/2, windowSize.height/2);
-            break;
-        }
-        case UIDeviceOrientationLandscapeRight: {
-            toastView.transform = CGAffineTransformMakeRotation(-M_PI/2);
-            point = CGPointMake(windowSize.width/2, windowSize.height/2);
-            break;
-        }
-        default:
-            break;
     }
     
     toastView.center = point;
diff --git a/ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m b/ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m
index 7538c41..cb4bb7b 100644
--- a/ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m
+++ b/ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m
@@ -182,6 +182,9 @@
     [[[UIApplication sharedApplication] keyWindow] endEditing:YES];  //hide keyboard
     UIWindow *window = [UIApplication sharedApplication].keyWindow;
     [window addSubview:self.backgroundView];
+    if ([WXUtility enableAdaptiveLayout]) {
+        self.backgroundView.center = window.center;
+    }
     if (self.isAnimating) {
         return;
     }
@@ -197,7 +200,6 @@
     [UIView animateWithDuration:0.35f animations:^{
         self.pickerView.frame = CGRectMake(0, [UIScreen mainScreen].bounds.size.height - WXPickerHeight, [UIScreen mainScreen].bounds.size.width, WXPickerHeight);
         self.backgroundView.alpha = 1;
-        
     } completion:^(BOOL finished) {
         self.isAnimating = NO;