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

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                               | Type                                 | Read-Only | Shared |
|----------------------------------------------------|--------------------------------------|-----------|--------|
| `AllowEditing<mobileimagepicker.allowediting>`     | `Boolean</api/data_types/boolean>`   |           |        |
| `Name<mobileimagepicker.name>`                     | `String</api/data_types/string>`     | ✓         |        |
| `SelectionLimit<mobileimagepicker.selectionlimit>` | `Integer</api/data_types/integer>`   |           |        |
| `Source<mobileimagepicker.source>`                 | `Sources<mobileimagepicker.sources>` |           |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                               | Parameters                                                                                         | Returns                                     | Shared |
|------------------------------------|----------------------------------------------------------------------------------------------------|---------------------------------------------|--------|
| `Handle<mobileimagepicker.handle>` |                                                                                                    | `Ptr</api/data_types/additional_types/ptr>` |        |
| `Show<mobileimagepicker.show>`     | parentScreen As `MobileScreen</api/user_interface/mobile/mobilescreen>` = `Nil</api/language/nil>` |                                             |        |

## Events

<div class="rst-class">

table-centered_column_4

</div>

| Name                                     | Parameters                              | Returns |
|------------------------------------------|-----------------------------------------|---------|
| `Cancelled<mobileimagepicker.cancelled>` |                                         |         |
| `Closing<mobileimagepicker.closing>`     |                                         |         |
| `Opening<mobileimagepicker.opening>`     |                                         |         |
| `Selected<mobileimagepicker.selected>`   | pic As `Picture</api/graphics/picture>` |         |

## Constants

> These constants are designed to be used with some <span class="title-ref">MobileImagePicker</span> methods to make code more readable.
>
> | Name               | Description                                                                                               |
> |--------------------|-----------------------------------------------------------------------------------------------------------|
> | UnlimitedSelection | A value that indicates there is no limit to the number of images a user can select (limited only by iOS). |

## Enumerations

<div id="mobileimagepicker.sources">

<div class="rst-class">

forsearch

</div>

</div>

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.                                |
> | FrontCamera | The user is prompted to take a picture with the front camera.                          |

## Property descriptions

<div id="mobileimagepicker.allowediting">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileImagePicker.AllowEditing

**AllowEditing** As `Boolean</api/data_types/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:
>
> ``` xojo
> MyImagePicker.AllowEditing = True
> MyImagePicker.Source = MobilePicturePicker.Sources.Photos
> MyImagePicker.Show
> ```

<div id="mobileimagepicker.name">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileImagePicker.Name

**Name** As `String</api/data_types/string>`

> The name of the control.

<div id="mobileimagepicker.selectionlimit">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileImagePicker.SelectionLimit

**SelectionLimit** As `Integer</api/data_types/integer>`

> Get or set the number of images the user can select when `Source<mobileimagepicker.source>` is set to `Photos`.
>
> Setting this property to 0 (default) or to MobileImagePicker.UnlimitedSelection means there is no limit to the number of images the user can select.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is not currently supported for Android.
>
> </div>

<div id="mobileimagepicker.source">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileImagePicker.Source

**Source** As `Sources<mobileimagepicker.sources>`

> Specifies the source of the image (the camera or the user's photo library).
>
> Prompt the user to take a picture:
>
> ``` xojo
> MyImagePicker.Source = MobileImagePicker.Sources.Camera
> MyImagePicker.Show
> ```

## Method descriptions

<div id="mobileimagepicker.handle">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileImagePicker.Handle

**Handle** As `Ptr</api/data_types/additional_types/ptr>`

> The handle to the underlying native OS control.
>
> On iOS, Handle returns a `Ptr</api/data_types/additional_types/ptr>` to an UIImagePickerController.

<div id="mobileimagepicker.show">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileImagePicker.Show

**Show**(parentScreen As `MobileScreen</api/user_interface/mobile/mobilescreen>` = `Nil</api/language/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:
>
> ``` xojo
> MyImagePicker.Show
> ```
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> The *parentScreen* parameter is not supported on Android.
>
> </div>

## Event descriptions

<div id="mobileimagepicker.cancelled">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileImagePicker.Cancelled

**Cancelled**

> The user cancelled choosing a picture.

<div id="mobileimagepicker.closing">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileImagePicker.Closing

**Closing**

> Called when the control's layout is closing.

<div id="mobileimagepicker.opening">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

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":
>
> ``` xojo
> Me.Text = "Hello"
> ```

<div id="mobileimagepicker.selected">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileImagePicker.Selected

**Selected**(pic As `Picture</api/graphics/picture>`)

> Called when a picture is selected.
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> On iOS, <span class="title-ref">MobileImagePicker</span> allows multiple image selection when the source is set to "Photos". Because it works async under the hood, the Selected event handler will be fired as many times as the images selected by the user.
>
> </div>
>
> Display the selected picture:
>
> ``` xojo
> MyImageViewer.Image = pic
> ```

## Notes

To use this class to choose a picture or take one with the camera on iOS, you must `enable the Photo Access entitlement</topics/application_structure/ios/ios_apps/entitlements_and_additional_information>`. 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.

## Compatibility

|                       |        |
|-----------------------|--------|
| **Project Types**     | Mobile |
| **Operating Systems** | All    |

<div class="seealso">

`MobileControl</api/user_interface/mobile/mobilecontrol>` parent class; `Picture</api/graphics/picture>` class

</div>
