Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Always add the modal view to the root view, not the current one - thi…

…s mimics standard modal view behaviour better
  • Loading branch information...
commit 2e3dbd72f8a3582e08685ba8e104d08c373a6a54 1 parent 286dd39
@reednj authored
Showing with 7 additions and 6 deletions.
  1. +7 −6 Source/UIViewController+TDSemiModalExtension.m
13 Source/UIViewController+TDSemiModalExtension.m
@@ -14,22 +14,23 @@ @implementation UIViewController (TDSemiModalExtension)
- (void) presentSemiModalViewController:(TDSemiModalViewController*)vc {
UIView* modalView = vc.view;
UIView* coverView = vc.coverView;
- coverView.frame = self.view.bounds;
+ UIView *rootView = UIApplication.sharedApplication.delegate.window.rootViewController.view;

This line supposed to be:

UIView *rootView = UIApplication.sharedApplication.delegate.window.rootViewController.presentedViewController.view

@reednj Owner
reednj added a note

Can you explain what the advantage is with that? It works better when showing the modal view inside another modal view or something?

i think the line should be:
UIView *rootView = self.view;

There is a bug in IOS, where the the view pointer you get is not always the one that is the top.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ coverView.frame = rootView.bounds;
coverView.alpha = 0.0f;
- modalView.frame = self.view.bounds;
+ modalView.frame = rootView.bounds; = self.offscreenCenter;
- [self.view addSubview:coverView];
- [self.view addSubview:modalView];
+ [rootView addSubview:coverView];
+ [rootView addSubview:modalView];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.6];
modalView.frame = CGRectMake(0, 0, modalView.frame.size.width, modalView.frame.size.height);
coverView.alpha = 0.5;
[UIView commitAnimations];
Please sign in to comment.
Something went wrong with that request. Please try again.