我正在尝试进行自定义设置,以使目标 View Controller 从顶部向下滑动。
我根据the documentation的示例编写了代码。
问题是执行segue时,源 View Controller 变黑,然后发生动画。如何防止源 View Controller 变黑?
(我已经尝试实现this answer中提供的解决方案,但是转换后屏幕要么变黑,要么恢复到源 View Controller 。)
这是我的代码:
-(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];
}
最佳答案
您的源 View Controller 似乎被隐藏的原因是立即显示了目标 View Controller 。
在编写自定义脚本时,您不会同时拥有两个 View 。你可以
在上述所有情况下,我说推送 View Controller 时,您都可以模态呈现 View Controller 。实际上,这可能更适合中间 View Controller 解决方案。
关于ios - 源 View Controller 在定制segue期间隐藏,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11719871/