PresentViewController与自定义“scale-from-center”ModalTransitionStyle [英] PresentViewController with custom “scale-from-center” ModalTransitionStyle
问题描述
我想实现自定义视图呈现过渡样式。这是我的代码:
I'm trying to implement custom view presenting transition style. Here is my code:
[myViewController setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[self presentViewController:myViewController animated:YES completion:^(void){}];
我想在呈现视图时实现从中心缩放效果。我使用JQuery UI进行了所需效果的演示: http://jsfiddle.net/c7ztP/
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/
有办法吗?
推荐答案
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];
// 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);
}];
}
为了这个工作,你需要 QuartzCore。框架
。也让它更甜,我会添加零alpha的全alpha的动画,因为它看起来更好。
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.
这篇关于PresentViewController与自定义“scale-from-center”ModalTransitionStyle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!