菜鸟教程小白 发表于 2022-12-11 20:06:40

ios - 在仅查看模式下使用 PDF Kit 加载 pdf


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

<pre><code>NSData *fileData = pathForResource:@&#34;PdfFormExample&#34; ofType:@&#34;pdf&#34;]];
PDFDocument *pdfDocument = [ initWithData:fileData];
PDFView *pdfView = [ initWithFrame:self.view.frame];
pdfView.document = pdfDocument
;
</code></pre>

<p>谢谢</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>我认为您想禁用 LongPressGestureRecognizer。像这样的:</p>

<pre><code>    private static void DisableDefaultLongPressGestureRecognizer(PdfKit.PdfView oPdfView)
    {
      oPdfView
            .GestureRecognizers
            .Where(x =&gt; x is UILongPressGestureRecognizer)
            .ForEach((oLongPressGestureRecognizer, nIndex) =&gt;
            {
                oLongPressGestureRecognizer.Enabled = false;
            });
    }
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 在仅查看模式下使用 PDF Kit 加载 pdf,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/50129228/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/50129228/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 在仅查看模式下使用 PDF Kit 加载 pdf