Xamarin.ios 表单在UIDocumentInteractionController中看不到打印选项

Xamarin.ios 表单在UIDocumentInteractionController中看不到打印选项,xamarin.ios,xamarin.forms,Xamarin.ios,Xamarin.forms,为什么我看不到菜单中的打印选项我错过了什么 private void OpenExtrnal() { Xamarin.Forms.Device.BeginInvokeOnMainThread(() => { UIView parentView = UIApplication.SharedApplication.KeyWindow.RootViewController.View;

为什么我看不到菜单中的打印选项我错过了什么

private void OpenExtrnal()
        {


            Xamarin.Forms.Device.BeginInvokeOnMainThread(() =>
            {

                UIView parentView = UIApplication.SharedApplication.KeyWindow.RootViewController.View;
                CGRect buttonFrame = new CGRect( 0 , -260 , 320 , 320);
                var PreviewController = UIDocumentInteractionController.FromUrl(new NSUrl(localDocUrl, true));
                PreviewController.Delegate = new UIDocumentInteractionControllerDelegateClass(UIApplication.SharedApplication.KeyWindow.RootViewController);
                if(passedImage != null && Device.Idiom == TargetIdiom.Tablet){
                    buttonFrame = FormsViewToNativeiOS.ConvertFormsToNative(passedImage).Frame;
                }

                PreviewController.PresentOpenInMenu(buttonFrame , parentView ,  true);
            });
        }
代理类

public class UIDocumentInteractionControllerDelegateClass : UIDocumentInteractionControllerDelegate
    {
        UIViewController viewC;

        public UIDocumentInteractionControllerDelegateClass(UIViewController controller)
        {
            viewC = controller;
        }

        public override UIViewController ViewControllerForPreview(UIDocumentInteractionController controller)
        {
            return viewC;
        }

        public override UIView ViewForPreview(UIDocumentInteractionController controller)
        {
            return viewC.View;
        }


    }

您必须使用
PreviewController.presentoptions菜单
而不是
PreviewController.presentoptions菜单
来显示诸如“打印”之类的选项

PresentOpenInMenu
PresentOptions Menu
之间的区别如下:

  • 要向用户提示一组选项,包括在另一个应用程序中打开文件的选项,请调用
    presentoptions menufromrect:inView:animated:
    presentoptions menufrombarbuttonItem:animated:
    方法
  • 要提示用户仅在另一个应用程序中打开文件,请调用
    presentOpenMinumeFromRect:inView:animated:
    presentOpenMinumeFromBarbuttonItem:animated:
    方法

请参阅苹果文档:。

Hi@Mina,我的答案对您有帮助吗?如果我的答案有帮助,请接受。这对我很重要。谢谢:)