Class ISN_UIImagePickerController
A view controller that manages the system interfaces for taking pictures, recording movies, and choosing items from the user's media library.
Inheritance
Inherited Members
Namespace: SA.iOS.UIKit
Assembly: cs.temp.dll.dll
Syntax
public class ISN_UIImagePickerController
Properties
AllowsEditing
A Boolean value indicating whether the user is allowed to edit a selected still image or movie. This property is set to false by default.
Declaration
public bool AllowsEditing { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
CameraDevice
The camera used by the image picker controller. The default is Rear
Declaration
public ISN_UIImagePickerControllerCameraDevice CameraDevice { get; set; }
Property Value
Type | Description |
---|---|
ISN_UIImagePickerControllerCameraDevice |
ImageCompressionFormat
Image compression format. Default value is JPEG
Declaration
public ISN_UIImageCompressionFormat ImageCompressionFormat { get; set; }
Property Value
Type | Description |
---|---|
ISN_UIImageCompressionFormat |
ImageCompressionRate
Is ImageCompressionFormat is set tp JPEG compression format value will be applied.
The default value is 0.8f
Declaration
public float ImageCompressionRate { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
MaxImageSize
Max allowed image size. If bigger image is picked by user, image will be resized before sending to Unity. Most of the images in user photo library are big, so it's better to use this property to save some RAM.
The default value is 512
Declaration
public int MaxImageSize { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The size of the max image. |
MediaTypes
An array indicating the media types to be accessed by the media picker controller.
Depending on the media types you assign to this property, the picker displays a dedicated interface for still images or movies, or a selection control that lets the user choose the picker interface. Before setting this property, check which media types are available by calling the GetAvailableMediaTypes(ISN_UIImagePickerControllerSourceType) class method.
If you set this property to an empty array, or to an array in which none of the media types is available for the current source, the system throws an exception.
You may use media type names from ISN_UIMediaType
Declaration
public List<string> MediaTypes { get; set; }
Property Value
Type | Description |
---|---|
List<System.String> |
ModalPresentationStyle
The presentation style for modally presented view controllers.
The presentation style determines how a modally presented view controller is displayed onscreen. In a horizontally compact environment, modal view controllers are always presented full-screen. In a horizontally regular environment, there are several different presentation options.
The default value for this property is Automatic. For a list of possible presentation styles, and their compatibility with the available transition styles, see the ISN_UIModalPresentationStyle constant descriptions.
Declaration
public ISN_UIModalPresentationStyle ModalPresentationStyle { get; set; }
Property Value
Type | Description |
---|---|
ISN_UIModalPresentationStyle |
SourceType
The type of picker interface to be displayed by the controller.
Prior to running the picker interface, set this value to the desired source type. The source type you set must be available and an exception is thrown if it is not. If you change this property while the picker is visible, the picker interface changes to match the new value in this property. The various source types are listed in the ISN_UIImagePickerControllerSourceType enumeration. The default value is PhotoLibrary.
Declaration
public ISN_UIImagePickerControllerSourceType SourceType { get; set; }
Property Value
Type | Description |
---|---|
ISN_UIImagePickerControllerSourceType |
Methods
GetAvailableMediaTypes(ISN_UIImagePickerControllerSourceType)
Returns an array of the available media types for the specified source type.
Some iOS devices support video recording. Use this method, along with the IsSourceTypeAvailable(ISN_UIImagePickerControllerSourceType) method, to determine if video recording is available on a device.
Declaration
public static List<string> GetAvailableMediaTypes(ISN_UIImagePickerControllerSourceType sourceType)
Parameters
Type | Name | Description |
---|---|---|
ISN_UIImagePickerControllerSourceType | sourceType | The source to use to pick an image. |
Returns
Type | Description |
---|---|
List<System.String> | The available media types. |
IsSourceTypeAvailable(ISN_UIImagePickerControllerSourceType)
Returns a Boolean value indicating whether the device supports picking media using the specified source type.
Because a media source may not be present or may be unavailable,
devices may not always support all source types.
For example, if you attempt to pick an image from the user’s library and the library is empty,
this method returns false
. Similarly, if the camera is already in use, this method returns false
.
Before attempting to use an ISN_UIImagePickerController object to pick an image, you must call this method to ensure that the desired source type is available.
Declaration
public static bool IsSourceTypeAvailable(ISN_UIImagePickerControllerSourceType sourceType)
Parameters
Type | Name | Description |
---|---|---|
ISN_UIImagePickerControllerSourceType | sourceType | Source Type. |
Returns
Type | Description |
---|---|
System.Boolean |
Present(Action<ISN_UIPickerControllerResult>)
Presents a view controller modally.
If you configured the view controller to use Camera,
the
Declaration
public void Present(Action<ISN_UIPickerControllerResult> callback)
Parameters
Type | Name | Description |
---|---|---|
Action<ISN_UIPickerControllerResult> | callback | Callback. |
SaveScreenshotToCameraRoll(Action<SA_Result>)
Saves the screen screenshot to the saved photos album.
Declaration
public static void SaveScreenshotToCameraRoll(Action<SA_Result> callback)
Parameters
Type | Name | Description |
---|---|---|
Action<SA_Result> | callback | Callback. |