【问题标题】:FormSheet modal dialog won't hideFormSheet 模态对话框不会隐藏
【发布时间】:2013-02-21 23:36:07
【问题描述】:

我有一个使用以下代码显示的模式对话框:

private void ShowUpdateDialog(float version, bool breakingChanges, string hint, string storeLink, string changelog, params string[] pars)
    {
        var dialog = new UpdatePopupController(this, new RectangleF(20, 20, 550, 600));
        dialog.WantsFullScreenLayout = true;
        dialog.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;
        dialog.ModalTransitionStyle = UIModalTransitionStyle.FlipHorizontal;
        dialog.ModalInPopover = true;
        UIDevice.CurrentDevice.BeginGeneratingDeviceOrientationNotifications();
        dialog.ShowData(version, breakingChanges, hint, storeLink, changelog, pars);
        dialog.WillRotate(UIApplication.SharedApplication.StatusBarOrientation, 0);
        NavigationController.PresentModalViewController(dialog, true);
        dialog.BecomeFirstResponder();
    }

我得到了这个结果(这是我所期望的):

现在我想通过敲出对话框的灰色内容来实现关闭对话框。我该怎么做?对话框本身继承自 UIViewController。

【问题讨论】:

  • 已接受答案中的解决方案不适用于带有 Xamarin.Forms 2.5.0 的 iOS 11.2,您最近有这种方法吗?

标签: dialog xamarin.ios modal-dialog


【解决方案1】:

不要让它成为模态的。然后就可以了

dialog.ModalInPopover = false;

【讨论】:

  • 终于有了一个很好用的简单解决方案。不需要额外的手势识别器等。干杯伙伴!
  • 这似乎不适用于带有 Xamarin.Forms 2.5.0 的 iOS 11.2
【解决方案2】:

See this question which asks the same thing.

我个人会有一个按钮,在 TouchDown 时会关闭模态视图。

【讨论】:

  • 我当然可以添加一个按钮。但我更愿意实现您拥有的功能,即在 iTunes 中的产品详情视图下。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-03-09
  • 2022-01-05
  • 1970-01-01
  • 1970-01-01
  • 2022-11-03
  • 2015-11-17
  • 1970-01-01
相关资源
最近更新 更多