From 489219a221e3fac4c11b8201a85e6fa95d9c3cf9 Mon Sep 17 00:00:00 2001 From: StuFF mc Date: Wed, 27 Feb 2013 10:56:18 +0100 Subject: [PATCH] =?UTF-8?q?Using=20`rootViewController`=20doesn't=20scale?= =?UTF-8?q?=20if=20the=20VC=20which=20presents=20SemiModal=20has=20already?= =?UTF-8?q?=20been=20presented=20modally.=20In=20this=20case=20the=20SemiM?= =?UTF-8?q?odal=20view=20is=20"hidden"=20behind=20the=20current=20view=20?= =?UTF-8?q?=E2=80=94=C2=A0option=20to=20pass=20in=20a=20view=20where=20the?= =?UTF-8?q?=20Modal=20VC=20will=20be=20presented.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/UIViewController+TDSemiModalExtension.h | 1 + Source/UIViewController+TDSemiModalExtension.m | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/UIViewController+TDSemiModalExtension.h b/Source/UIViewController+TDSemiModalExtension.h index 42d0ec6..6a71c7c 100644 --- a/Source/UIViewController+TDSemiModalExtension.h +++ b/Source/UIViewController+TDSemiModalExtension.h @@ -12,6 +12,7 @@ @interface UIViewController (TDSemiModalExtension) -(void)presentSemiModalViewController:(TDSemiModalViewController*)vc; +-(void)presentSemiModalViewController:(TDSemiModalViewController*)vc inView:(UIView *)rootView; -(void)dismissSemiModalViewController:(TDSemiModalViewController*)vc; -(void)dismissSemiModalViewControllerEnded:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context; diff --git a/Source/UIViewController+TDSemiModalExtension.m b/Source/UIViewController+TDSemiModalExtension.m index b7cc6f9..93fa5fb 100644 --- a/Source/UIViewController+TDSemiModalExtension.m +++ b/Source/UIViewController+TDSemiModalExtension.m @@ -12,9 +12,13 @@ @implementation UIViewController (TDSemiModalExtension) // Use this to show the modal view (pops-up from the bottom) - (void) presentSemiModalViewController:(TDSemiModalViewController*)vc { + [self presentSemiModalViewController:vc inView:UIApplication.sharedApplication.delegate.window.rootViewController.view]; +} + +- (void) presentSemiModalViewController:(TDSemiModalViewController*)vc inView:(UIView *)rootView { + UIView* modalView = vc.view; UIView* coverView = vc.coverView; - UIView *rootView = UIApplication.sharedApplication.delegate.window.rootViewController.view; coverView.frame = rootView.bounds; coverView.alpha = 0.0f;