Skip to content

Commit

Permalink
Using rootViewController doesn't scale if the VC which presents Sem…
Browse files Browse the repository at this point in the history
…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
StuFF mc committed Feb 27, 2013
1 parent 004789f commit 489219a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions Source/UIViewController+TDSemiModalExtension.h
Expand Up @@ -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;

Expand Down
6 changes: 5 additions & 1 deletion Source/UIViewController+TDSemiModalExtension.m
Expand Up @@ -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;
Expand Down

0 comments on commit 489219a

Please sign in to comment.