IOS 自定义界面切换动画-Custom Segue

发布时间:2017-09-03 13:19:12
IOS 自定义界面切换动画-Custom Segue

实现方式就是继承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]; }]; } 最后的示意

\

\

\

企业建站2800元起,携手武汉肥猫科技,做一个有见地的颜值派!更多优惠请戳:武汉网站建设 http://wuhan.45qun.com