Skip to content

TMSFMXNativeUIImagePickerController

Usage

The TMSFMXNativeUIImagePickerController manages customizable, system-supplied user interfaces for taking pictures and movies on supported devices, and for choosing saved images and movies for use in your application.

Published Properties

Property name Description
AllowsEditing Allows editing of images after selecting an image.
CameraCaptureMode Sets the camera to photo or video capture mode.
CameraDevice Determines whether the front or rear camera should be used.
CameraFlashMode The flash mode of the camera set to off, on or auto.
EditedImage Boolean to determine if the ImagePicker needs to save the original or edited image. Editing an image can be done when AllowsEditing is true.
SaveToAlbum When an image is taken, automatically save it to the users album.
ShowCameraControls Shows / hides the camera controls when the source type is set to stImagePickerControllerSourceTypeCamera.
SourceType Specific whether the image picker controller should display the photo library, the camera or the saved photos album.
VideoMaximumDuration Sets the maximum duration of a video.
VideoQuality Sets the quality of a video.

Public Properties

Property name Description
ImagePicker Returns a reference to the native iOS UIImagePickerController.
Popover Returns a reference to the native iOS UIPopoverController.

Methods

Method name Description
Hide Hides the ImagePicker.
Show Shows the ImagePicker fullscreen. (iPhone & iPad), on iPad only when SourceType property is set to stImagePickerControllerSourceTypeCamera. When SourceType is set to a different value,use the other Show methods such as ShowFromButton or ShowFromControl.
ShowFromButton(AButton: UIBarButtonItem) Shows the ImagePicker from a ToolBar button. (iPad only)
ShowFromControl(AControl: TTMSFMXNativeUIBaseControl) Shows the ImagePicker from a TMS FMX Native UI Control on the form. (iPad only)
ShowFromRect(ARect: TRectF) Shows the ImagePicker from a specific rectangle in the main view. (iPad only)
ShowFromRectInView(ARect: TRectF; AView: UIView) Shows the ImagePicker from a specific rectangle in a specific view. (iPad only)
StartVideoCapture Starts the video capture.
StopVideoCapture Stops the video capture.

Public Events

Events name Description
OnDidFinishPickingMediaWithInfo Access directly to the media dictionary after taking an image or capturing a video with a native reference to an NSDictionary reference.
OnDidFinishPickingImage Event called when taking an image with native access to a UIImage reference.

Events

Events name Description
OnDidCancel Event called when cancel is pressed.
OnDidFinishPickingBitmap Event called when an image is taken or picked and the image is converted to a TBitmap.

Starting from iOS 10 a new NSPhotoLibraryUsageDescription key is necessary on order to correctly initialize the photo library and prevent the application from crashing. This key needs to be added to each individual project. Start by going to the project options and go to version info. Scroll to the bottom, right-click and select “Add Key”.

TMSFMXNativeUIImagePickerController

A dialog will popup, prompting for the new version info key. Fill in “NSPhotoLibraryUsageDescription”.

TMSFMXNativeUIImagePickerController1

After clicking “OK”, the new entry still needs a value, which can be anything descriptive for your application. In the demo, we have added “Uses the photo library”

TMSFMXNativeUIImagePickerController2