tencent cloud

Tencent Cloud Super App as a Service

Customizing Image Selection

Download
Focus Mode
Font Size
Last updated: 2025-07-04 18:03:44
AI-Translated
The mini program SDK provides a default image selection feature, which uses the system's built-in gallery picker when the mini program calls the multimedia selection (wx.chooseImage).
You can customize the image selection by overriding the selectMediaFromPickerWithModel method.

// Select the media from the image picker
// @param model Configuration
// @param parentVC The view controller from which to present the picker
// @param completionBlock A block that returns the selected media data upon completion, accepting TMAPickerImageModel or TMAPickerVideoModel based on the selection.
- (void)selectMediaFromPickerWithModel:(TMAMediaChooseConfigModel *)model
parentVC:(UIViewController *)parentVC
completionBlock:(void(^)(NSArray * _Nullable medias, NSError * _Nullable error))completionBlock;


// Capture media using the camera
// @param model Configuration
// @param parentVC The view controller from which to present the camera
// @param completionBlock A block that returns the captured media data upon completion, accepting TMACameraImageModel or TMACameraVideoModel based on the selection
- (void)selectMediaFromCameraWithModel:(TMAMediaChooseConfigModel *)model
parentVC:(UIViewController *)parentVC
completionBlock:(void(^)(id _Nullable media, NSError * _Nullable error))completionBlock;


// Get the image data from a PHAsset
// @param phAsset The media object
// @param needCompress - Whether compression is required
- (NSData *)imageDataFromPhAsset:(PHAsset *)phAsset needCompress:(BOOL)needCompress;




Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback