Question

I'm trying to implement custom view presenting transition style. Here is my code:

[myViewController setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[self presentViewController:myViewController animated:YES completion:^(void){}];

I'd like to achieve “scale from center” effect while presenting views. I made a demo of desired effect with JQuery UI: http://jsfiddle.net/c7ztP/

Is there any way to do this?

Was it helpful?

Solution

What I would do is the following

From the initiating view controller i would do this

// OriginalViewController.h
newViewcontroller.view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.0f, 0.0f);
[self presentViewController:newViewController animated:NO completion:nil];

And on the receiving view controller I would do this

-(void)viewDidLoad {
   [UIView animateWithDuration:0.3f animations:^{
    self.view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.0f, 1,0f);
   }];
}

For this to work you'll need QuartzCore.framework. Also to make it sweeter I would add zero alpha to full alpha animated as it looks better.

OTHER TIPS

You should write your own Controller with this animation effect.
Look at this controls: KGModal and UAModalPanel.
Check theirs source code for animation example. It's not difficult to rewrite this code to support fullscreen view.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top