How to open the Document files e.g(.pdf,.doc,.docx) in ios mobile when a button action using swift3.0?

后端 未结 3 1749
我在风中等你
我在风中等你 2020-12-05 05:15

I need to open UIDocumentPickerViewController and It should allow user to select all type of files. ie.(.pdf,.doc)files I used UIDocumentPickerViewControl

3条回答
  •  自闭症患者
    2020-12-05 06:13

    Actually, instead of WebView you could also use the QuickLook Framework, which is designed for this specific purpose. You just pass the location of the file and conform to the protocols. It will present a view controller with the document inside.

    It supports the following file:

    - iWork documents (Pages, Numbers and Keynote)

    - Microsoft Office documents (as long as they’ve been created with Office 97 or any other newer version)

    - PDF files

    - Images

    - Text files

    - Rich-Text Format documents

    - Comma-Separated Value files (csv)

    Here is a tutorial by APPCODA, that describes the same.

    and

    Here is the tutorial provided by Apple OBJ-C version.

提交回复
热议问题