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.

Properties

Name

Type

Read-Only

Shared

AllowEditing

Boolean

Name

String

Source

Sources

Methods

Name

Parameters

Returns

Shared

Handle

Ptr

Show

parentScreen As MobileScreen = Nil

Events

Name

Parameters

Returns

Cancelled

Closing

Opening

Selected

pic As Picture

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 = iOSPicturePicker.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 a 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

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