1

私は現在ココアに取り組んでいるので、Macの開発には少し慣れていません。
サーバーからPDFを開きたい。これはで可能PDFViewですか?
誰かがこれで私を導くならば、それは私にとって非常に役に立ちます。
PDFViewでPDFファイルを開くためのサンプルコードはありますか?

前もって感謝します..!!!

4

3 に答える 3

4

答えが出ました。

少なくとも私のために働いています..:)

NSString *urlStr = [[NSBundle mainBundle] pathForResource:@"1.pdf" ofType:nil];
NSURL *url = [NSURL fileURLWithPath:urlStr];
PDFDocument *pdfDoc = [[PDFDocument alloc] initWithURL:url];
[pdfView setDocument:pdfDoc];
于 2011-11-10T08:36:35.410 に答える
3

Swiftバージョン(Quartzモジュールをインポートすることを忘れないでください)

    guard let docPath = NSBundle.mainBundle().pathForResource("1", ofType: "pdf") else { return }

    let docURL = NSURL.fileURLWithPath(docPath)
    let pdfDocument = PDFDocument(URL: docURL)
于 2016-08-31T00:37:57.070 に答える
1

Swift3.0バージョン:)

    guard let docPath = Bundle.main.path(forResource: "1", ofType: "pdf") else { return }

    let docURL = NSURL.fileURL(withPath: docPath)
    let pdfDocument = PDFDocument(url: docURL)
    uxPdf.document = pdfDocument
于 2017-04-12T11:26:25.707 に答える