IOS 自定义界面切换动画Custom Segue -电脑资料

电脑资料 时间:2019-01-01 我要投稿
【www.unjs.com - 电脑资料】

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

   

最新文章