Eri*_*ric 5 core-animation ios uistoryboard uistoryboardsegue
我正在尝试创建自定义segue,以便目标视图控制器从顶部向下滑动.
我根据文档中的示例编写了我的代码.
问题是当执行segue时,源视图控制器变黑,然后动画发生.如何防止源视图控制器变黑?
(我已经尝试实现此答案中提供的解决方案,但屏幕在转换后变为黑色,或者恢复为源视图控制器.)
这是我的代码:
-(void)perform{
UIViewController *splashScreen = self.sourceViewController;
UIViewController *mainScreen = self.destinationViewController;
//Place the destination VC above the visible area
mainScreen.view.center = CGPointMake(mainScreen.view.center.x,
mainScreen.view.center.y-600);
//Animation to move the VC down into the visible area
[UIView animateWithDuration:1
animations:^{
mainScreen.view.center = CGPointMake(mainScreen.view.center.x, [[UIScreen mainScreen] bounds].size.height/2 );
}
];
[splashScreen presentModalViewController:mainScreen animated:NO];
}
Run Code Online (Sandbox Code Playgroud)
源视图控制器似乎被隐藏的原因是目标视图控制器立即呈现。
当您编写自定义 Segue 时,您不会同时拥有两个可用的视图。你可以
在我所说的推送视图控制器的所有上述情况下,您可以改为以模态方式呈现视图控制器。事实上,这可能更适合中间视图控制器解决方案。
| 归档时间: |
|
| 查看次数: |
1445 次 |
| 最近记录: |