Skip to content

Instantly share code, notes, and snippets.

@badeen
Created October 16, 2012 18:10
Show Gist options
  • Save badeen/3900982 to your computer and use it in GitHub Desktop.
Save badeen/3900982 to your computer and use it in GitHub Desktop.
- (IBAction)open:(id)sender
{
CATransform3D perspectiveTransform = CATransform3DIdentity;
perspectiveTransform.m34 = 1.0f / -2000.0f;
CATransform3D endScaleTransform = CATransform3DMakeScale(0.8f, 0.8f, 1.0f);
CATransform3D startTransform = perspectiveTransform;
CATransform3D endTransform = CATransform3DConcat(endScaleTransform, perspectiveTransform);
CATransform3D middleTransform = CATransform3DConcat(CATransform3DMakeRotation(M_PI_4 / 2.0f, 1, 0, 0), endTransform);
CAKeyframeAnimation *pushBackAnim = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
pushBackAnim.values = @[[NSValue valueWithCATransform3D:startTransform], [NSValue valueWithCATransform3D:middleTransform], [NSValue valueWithCATransform3D:endTransform]];
pushBackAnim.duration = 0.3f;
pushBackAnim.calculationMode = kCAAnimationCubic;
pushBackAnim.removedOnCompletion = NO;
pushBackAnim.fillMode = kCAFillModeForwards;
[self.view.layer addAnimation:pushBackAnim forKey:@"pushBackAnimation"];
UIWindow *modalWindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
modalWindow.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
modalWindow.opaque = NO;
modalWindow.backgroundColor = [UIColor colorWithWhite:0.0f alpha:0.3f]
UIViewController *vc = [[UIViewController alloc] init];
vc.view.backgroundColor = [UIColor greenColor];
vc.view.opaque = NO;
modalWindow.rootViewController = vc;
dispatch_async(dispatch_get_main_queue(), ^{
[modalWindow setHidden:NO];
[modalWindow makeKeyAndVisible];
});
/*CGFloat modalHeight = 200.0f;
UIView *testView = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(modalWindow.bounds) - modalHeight, CGRectGetWidth(modalWindow.bounds), modalHeight)];
testView.backgroundColor = [UIColor greenColor];
testView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleTopMargin;
[modalWindow addSubview:testView];*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment