Xamarin.iOS:UIAlertController 不会禁用其他 UIBarButtonItem

问题描述

我正在尝试在 UINavigationItem 中显示带有 UIBarButtonItem 的菜单 (UIAlertController)。

但如果我这样做:

            if (alertMenu.PopoverPresentationController != null)
            {
                alertMenu.PopoverPresentationController.BarButtonItem = overflowButton;
                alertMenu.PopoverPresentationController.PermittedArrowDirections = UIPopoverArrowDirection.Up;
            }

UINavigationItem 中的其他 UIBarButtonItems 仍然可以点击而不关闭 Menu。但我希望按钮不可点击。

所以我是这样试的:

            if (alertMenu.PopoverPresentationController != null)
            {

                alertMenu.PopoverPresentationController.SourceView = overflowButton.ValueForKey(new NSString("view")) as UIView;
                alertMenu.PopoverPresentationController.PermittedArrowDirections = UIPopoverArrowDirection.Up;
            }

哪个有效,但有没有办法像第一种方法那样做,因为它看起来更干净。或者这不可能吗?这是错误还是功能?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)