Platforms to show: All Mac Windows Linux Cross-Platform
Last modified Mon, 9th Nov 2025.
You find this example project in your MBS Xojo Plugin download as a Xojo project file within the examples folder: /iOS/Document Picker iOS
Download this example: Document Picker iOS.zip
Project "Document Picker iOS.xojo_binary_project"
Class App Inherits MobileApplication
End Class
Class MainScreen Inherits MobileScreen
Control OpenButton Inherits MobileButton
ControlInstance OpenButton Inherits MobileButton
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
EventHandler Sub Pressed()
System.DebugLog CurrentMethodName
table1.RemoveAllRows
OpenButton.Enabled = False
ExportButton.Enabled = False
MoveButton.Enabled = False
ImportButton.Enabled = False
Dim types() As String
types.append "public.jpeg"
types.append "public.png"
Dim asCopy As Boolean = True
picker = New UIDocumentPicker(UIDocumentPicker.ModeOpen, types, asCopy)
picker.Screen = Self
picker.Present
End EventHandler
End Control
Control Table1 Inherits iOSMobileTable
ControlInstance Table1 Inherits iOSMobileTable
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
End Control
Control ExportButton Inherits MobileButton
ControlInstance ExportButton Inherits MobileButton
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
EventHandler Sub Pressed()
Dim pic As Picture = LogoMBS(500)
Dim file As FolderItem = SpecialFolder.Documents.Child("test.jpg")
pic.Save(file, Picture.Formats.JPEG)
OpenButton.Enabled = False
MoveButton.Enabled = False
ExportButton.Enabled = False
ImportButton.Enabled = False
Dim URLs() As String
urls.add(file.URLPath)
picker = New UIDocumentPicker(UIDocumentPicker.ModeExportToService, URLs, True)
picker.Screen = Self
picker.Present
End EventHandler
End Control
Control ImportButton Inherits MobileButton
ControlInstance ImportButton Inherits MobileButton
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
EventHandler Sub Pressed()
System.DebugLog CurrentMethodName
table1.RemoveAllRows
OpenButton.Enabled = False
MoveButton.Enabled = False
ExportButton.Enabled = False
ImportButton.Enabled = False
Dim types() As String
types.append "public.jpeg"
types.append "public.png"
Dim asCopy As Boolean = True
picker = New UIDocumentPicker(UIDocumentPicker.ModeImport, types, asCopy)
picker.Screen = Self
picker.Present
End EventHandler
End Control
Control MoveButton Inherits MobileButton
ControlInstance MoveButton Inherits MobileButton
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
EventHandler Sub Pressed()
Dim pic As Picture = LogoMBS(500)
Dim file As FolderItem = SpecialFolder.Documents.Child("test.jpg")
pic.Save(file, Picture.Formats.JPEG)
OpenButton.Enabled = False
ExportButton.Enabled = False
MoveButton.Enabled = False
ImportButton.Enabled = False
Dim URLs() As String
urls.add(file.URLPath)
picker = New UIDocumentPicker(UIDocumentPicker.ModeMoveToService, URLs, True)
picker.Screen = Self
picker.Present
End EventHandler
End Control
Property picker As UIDocumentPicker
End Class
Class LaunchScreen Inherits iosView
End Class
Sign
End Sign
Sign
End Sign
Class UIDocumentPicker Inherits UIDocumentPickerMBS
EventHandler Sub documentPickerDidPickDocuments(URLs() as String)
If screen = Nil Then Break
If me.documentPickerMode = ModeExportToService Then
MessageBox "Exported."
Else // import/open
For Each url As String In urls
dim file as new FolderItem(url, FolderItem.PathModes.URL)
screen.Table1.AddRow file.DisplayName
Next
end if
Screen.OpenButton.Enabled = True
Screen.ExportButton.Enabled = True
Screen = Nil
End EventHandler
EventHandler Sub documentPickerWasCancelled()
if Screen <> nil then
Screen.OpenButton.Enabled = True
Screen.MoveButton.Enabled = True
Screen.ExportButton.Enabled = True
screen.ImportButton.Enabled = true
Screen = Nil
end If
End EventHandler
Property screen As MainScreen
End Class
End Project
Download this example: Document Picker iOS.zip
The items on this page are in the following plugins: MBS iOS Plugin.