This non-visible control allows selection of an image stored on the device (or taken with the camera) for use in the app.
These are the source locations from which the user can select a picture.
Lets the user choose a picture from anywhere on the device (albums, camera roll, etc).
The user is prompted to take a picture with the camera.
AllowEditing As Boolean
Indicates if the user can edit the picture in the picker.
Display a picture picker that lets the user edit the picture they select:
MyImagePicker.AllowEditing = True MyImagePicker.Source = iOSPicturePicker.Sources.Photos MyImagePicker.Show
Name As String
The name of the control.
Source As Sources
Specifies the source of the image (the camera or the user's photo library).
Prompt the user to take a picture:
MyImagePicker.Source = MobileImagePicker.Sources.Camera MyImagePicker.Show
Handle As Ptr
The a handle to the underlying native OS control.
Displays the image picker.
Passing an optional parentScreen allows you to specify the parent screen. This can be helpful when the parent screen is modal.
This is not modal so your code continues running after calling Show. The Cancelled and Selected events are called based on the user's action.
Display the image picker:
The user cancelled choosing a picture.
Called when the control's layout is closing.
Called when the control's layout is opening.
This is where you typically put initialization code.
This example in the Opening event of a label sets its text to "Hello":
Me.Text = "Hello"
Selected(pic As Picture)
Called when a picture is selected.
Display the selected picture:
MyImageViewer.Image = pic
To use this class to choose a picture or take one with the camera, you must enable the Photo Access entitlement. To take a picture with the camera and/or save photos to the photo library, enabled Write access via the Options dialog box. To use share a photo from the photo library or camera, choose Read access.
On iOS, Handle returns a Ptr to an UIImagePickerController.
Mobile projects on all supported mobile operating systems.