Class
MobileImagePicker
Description
This non-visible control allows selection of an image stored on the device (or taken with the camera) for use in the app.
Methods
Name |
Parameters |
Returns |
Shared |
---|---|---|---|
parentScreen As MobileScreen = Nil |
Enumerations
MobileImagePicker.Sources
Sources
These are the source locations from which the user can select a picture.
Enum |
Description |
---|---|
Photos |
Lets the user choose a picture from anywhere on the device (albums, camera roll, etc). |
Camera |
The user is prompted to take a picture with the camera. |
Property descriptions
MobileImagePicker.AllowEditing
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 = MobilePicturePicker.Sources.Photos
MyImagePicker.Show
MobileImagePicker.Name
Name As String
The name of the control.
MobileImagePicker.Source
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
Method descriptions
MobileImagePicker.Handle
Handle As Ptr
The handle to the underlying native OS control.
MobileImagePicker.Show
Show(parentScreen As MobileScreen = Nil)
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:
MyImagePicker.Show
Note
The parentScreen parameter is not supported on Android.
Event descriptions
MobileImagePicker.Cancelled
Cancelled
The user cancelled choosing a picture.
MobileImagePicker.Closing
Closing
Called when the control's layout is closing.
MobileImagePicker.Opening
Opening
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"
MobileImagePicker.Selected
Selected(pic As Picture)
Called when a picture is selected.
Display the selected picture:
MyImageViewer.Image = pic
Notes
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.
Compatibility
Mobile projects on all supported mobile operating systems.
See also
MobileControl parent class; Picture class