Permalink
Browse files

Using `rootViewController` doesn't scale if the VC which presents Sem…

…iModal has already been presented modally. In this case the SemiModal view is "hidden" behind the current view — option to pass in a view where the Modal VC will be presented.
  • Loading branch information...
1 parent 004789f commit 489219a221e3fac4c11b8201a85e6fa95d9c3cf9 @stuffmc stuffmc committed Feb 27, 2013
@@ -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;
@@ -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;

0 comments on commit 489219a

Please sign in to comment.