You find this example project in your Plugins Download as a Xojo project file within the examples folder: /iOS/QLPreviewController test
Class App Inherits MobileApplication
End Class
Class Screen1 Inherits MobileScreen
Control ShowButton Inherits MobileButton
ControlInstance ShowButton Inherits MobileButton
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
EventHandler Sub Pressed()
// we show the controller here with editing disabled
panel = New QLPreviewControllerMBS
panel.AddItem PDFFile
panel.Present
End EventHandler
End Control
Control EditButton Inherits MobileButton
ControlInstance EditButton Inherits MobileButton
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
EventHandler Sub Pressed()
// we show the controller here with editing enabled
Dim panel As New QLPreviewController
panel.AddItem PDFFile
panel.editingAllowed = true
panel.Present
Self.Panel = panel // keep reference until it is closed
End EventHandler
End Control
EventHandler Sub Opening()
// we load a sample PDF, so we can show you something.
PDFFile = SpecialFolder.Documents.Child("Installation.pdf")
Download = New URLConnection
AddHandler Download.FileReceived, WeakAddressOf FileReceived
Download.Send "GET", "https://www.monkeybreadsoftware.de/xojo/download/plugin/Installation.pdf", PDFFile
End EventHandler
Sub FileReceived(Connection As URLConnection, URL As String, HTTPStatus As Integer, file As FolderItem)
If HTTPStatus <> 200 Then
MessageBox "Download of PDF failed!"
Break
return
End If
ShowButton.Enabled = True
EditButton.Enabled = True
End Sub
Property Download As URLConnection
Property PDFFile As FolderItem
Property Panel As QLPreviewControllerMBS
End Class
Class LaunchScreen Inherits iosView
End Class
Class QLPreviewController Inherits QLPreviewControllerMBS
EventHandler Sub DidDismiss()
System.DebugLog CurrentMethodName
End EventHandler
EventHandler Sub WillDismiss()
System.DebugLog CurrentMethodName
End EventHandler
EventHandler Sub didSaveEditedCopyOfPreviewItem(Item as FolderItem, modifiedContentsFile as FolderItem)
System.DebugLog CurrentMethodName
// we copy it over the old file, but you may do more
item.Remove
modifiedContentsFile.CopyTo Item
End EventHandler
EventHandler Sub didUpdateContentsOfPreviewItem(Item as FolderItem)
System.DebugLog CurrentMethodName
End EventHandler
EventHandler Function editingModeForPreviewItem(Item as FolderItem) As Integer
System.DebugLog CurrentMethodName
If editingAllowed Then
Return EditingModeCreateCopy
Else
Return EditingModeDisabled
End If
End EventHandler
Property editingAllowed As Boolean
End Class