IOS 自定义界面切换动画-Custom Segue
时间:2014-12-28 11:44:48
收藏:0
阅读:337
原创Blog,转载请注明出处
http://blog.csdn.net/hello_hwc?viewmode=contents
实现方式就是继承UIStoryboardSegue类,然后重写Perform方法,然后在Storyboard上将类设置为自定义的类
这段代码的作用是创建从中心渐变充满屏幕的动画
-(void)perform{
UIViewController * svc = self.sourceViewController;
UIViewController * dvc = self.destinationViewController;
[svc.view addSubview:dvc.view];
[dvc.view setFrame:svc.view.frame];
[dvc.view setTransform:CGAffineTransformMakeScale(0.1, 0.1)];
[dvc.view setAlpha:0.0];
[UIView animateWithDuration:1.0
animations:^{
[dvc.view setTransform:CGAffineTransformMakeScale(1.0, 1.0)];
[dvc.view setAlpha:1.0];
}
completion:^(BOOL finished) {
// [dvc.view removeFromSuperview];
}];
}最后的示意
完整的Demo工程
http://pan.baidu.com/s/1qWodA7E
原文:http://blog.csdn.net/hello_hwc/article/details/42212023
评论(0)