From 2957554ac174e8024305a9fad38b5ace740e9569 Mon Sep 17 00:00:00 2001 From: Rossen Hristov Date: Tue, 14 Jul 2015 16:03:09 +0300 Subject: [PATCH] Resovled Issue #421: Modal pages do not render correctly in iOS. --- ui/core/view.ios.ts | 2 +- ui/page/page.ios.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/core/view.ios.ts b/ui/core/view.ios.ts index 2b36260ce..586e4c123 100644 --- a/ui/core/view.ios.ts +++ b/ui/core/view.ios.ts @@ -179,7 +179,7 @@ export class View extends viewCommon.View { // When in landscape in iOS 7 there is transformation on the first subview of the window so we set frame to its subview. // in iOS 8 we set frame to subview again otherwise we get clipped. var nativeView: UIView; - if (!this.parent && this._nativeView.subviews.count > 0) { + if (!this.parent && this._nativeView.subviews.count > 0 && !(this)._isModal) { trace.write(this + " has no parent. Setting frame to first child instead.", trace.categories.Layout); nativeView = (this._nativeView.subviews[0]); } diff --git a/ui/page/page.ios.ts b/ui/page/page.ios.ts index 997492a9f..3caa48bd2 100644 --- a/ui/page/page.ios.ts +++ b/ui/page/page.ios.ts @@ -150,6 +150,10 @@ export class Page extends pageCommon.Page { protected _showNativeModalView(parent: Page, context: any, closeCallback: Function, fullscreen?: boolean) { (this)._isModal = true; + if (!parent.ios.view.window) { + throw new Error("Parent page is not part of the window hierarchy. Close the current modal page before showing another one!"); + } + if (fullscreen) { this._ios.modalPresentationStyle = UIModalPresentationStyle.UIModalPresentationFullScreen; utils.ios._layoutRootView(this, UIScreen.mainScreen().bounds);