Created
April 8, 2013 16:06
-
-
Save iamphill/5338003 to your computer and use it in GitHub Desktop.
Popup Present Model View
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)presentModalViewController:(UIViewController *)modalViewController fromView:(UIView *)view | |
{ | |
if(SYSTEM_VERSION_LESS_THAN(@"6.0")) { | |
[modalViewController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal]; | |
[self presentViewController:modalViewController animated:YES completion:nil]; | |
} else { | |
modalViewController.modalPresentationStyle = UIModalPresentationFormSheet; | |
UIGraphicsBeginImageContext(self.view.window.frame.size); | |
[self.view.window.layer renderInContext:UIGraphicsGetCurrentContext()]; | |
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
[self.view.window setBackgroundColor:[UIColor colorWithPatternImage:viewImage]]; | |
// Add the modal viewController but don't animate it. We will handle the animation manually | |
[self presentModalViewController:modalViewController animated:NO]; | |
[modalViewController.view setTransform:CGAffineTransformMakeScale(0, 0)]; | |
[UIView animateWithDuration:0.3f animations:^{ | |
[modalViewController.view setTransform:CGAffineTransformMakeScale(1, 1)]; | |
}]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment