OGeek|极客世界-中国程序员成长平台

标题: ios - 在仅查看模式下使用 PDF Kit 加载 pdf [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 20:06
标题: ios - 在仅查看模式下使用 PDF Kit 加载 pdf

我正在使用以下简单代码来加载 pdf 表单,但我不希望它以可编辑的形式加载。我没有找到任何限制它以仅查看模式加载的内容。

NSData *fileData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource"dfFormExample" ofType"pdf"]];
PDFDocument *pdfDocument = [[PDFDocument alloc] initWithData:fileData];
PDFView *pdfView = [[PDFView alloc] initWithFrame:self.view.frame];
pdfView.document = pdfDocument
[self.view addSubView:pdfView];

谢谢



Best Answer-推荐答案


我认为您想禁用 LongPressGestureRecognizer。像这样的:

    private static void DisableDefaultLongPressGestureRecognizer(PdfKit.PdfView oPdfView)
    {
        oPdfView
            .GestureRecognizers
            .Where(x => x is UILongPressGestureRecognizer)
            .ForEach((oLongPressGestureRecognizer, nIndex) =>
            {
                oLongPressGestureRecognizer.Enabled = false;
            });
    }

关于ios - 在仅查看模式下使用 PDF Kit 加载 pdf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50129228/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4