【问题标题】:Xamarin - prevent new ios 13 sheet style presentationXamarin - 防止新的 ios 13 表单样式演示
【发布时间】:2019-10-02 09:44:46
【问题描述】:
有什么办法可以避免在 ios 13 上引入的新的演示文稿样式?
我试图在我的 CustomNavigationRenderer 中做到这一点,但运气不好
public class CustomNavigationRenderer : NavigationRenderer
{
public override void ViewDidLoad()
{
base.ViewDidLoad();
base.ModalPresentationStyle = UIModalPresentationStyle.FullScreen;
...
}
【问题讨论】:
标签:
xamarin
ios13
uimodalpresentationstyle
【解决方案1】:
是的。如果您查看here,您可以看到UIModalPresentationAutomatic 默认为UIModalPresentationPageSheet。只需将您的 modalPresentationStyle 更改为 UIModalPresentationFullScreen。
首先创建您的新视图控制器。 这个需要设置modalPresentationStyle属性。
var modalViewController = new UIViewController();
modalViewController.modalPresentationStyle = UIModalPresentationStyle.FullScreen;
然后,在 NavigationPage 的顶部呈现这个 viewController。 NavigationRenderer 有一个名为ViewController 的属性:
this.ViewController.presentViewController(modalViewController, true, nil);