xcode 无需使用转场就需要交叉溶解过渡
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16703106/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cross dissolve transition required without using segue
提问by RGriffiths
I want to use the Cross Dissolve transition but not by using a segue. I use the code below to present the new view when a button is pressed but the transition is Cover Vertical. Is there any way of changing this?
我想使用 Cross Dissolve 过渡,但不想使用 segue。我使用下面的代码在按下按钮时显示新视图,但过渡是 Cover Vertical。有什么办法可以改变这种情况吗?
ObViewControllerMonitorMenu *monitorMenuViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"observationSummary"];
monitorMenuViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:monitorMenuViewController animated:YES completion:nil];
The code above now works with the additional line to set the transition type.
上面的代码现在使用附加行来设置转换类型。
回答by Valent Richie
Please take a look at the documentation to see the list of transition style while presenting a view controller modally, especially at the section Presenting View Controllers
:
请查看文档以查看以模态方式呈现视图控制器时的过渡样式列表,尤其是在以下部分Presenting View Controllers
:
https://developer.apple.com/reference/uikit/uiviewcontroller?language=objc
https://developer.apple.com/reference/uikit/uiviewcontroller?language=objc
(快速回答)
And then you can set the modalTransitionStyleproperty of the view controller to the desired value, in which what you want is UIModalTransitionStyleCrossDissolve
.
然后你可以将视图控制器的modalTransitionStyle属性设置为所需的值,其中你想要的是UIModalTransitionStyleCrossDissolve
.