Delphi直接实现分享图片功能
procedure TCustomCameraViewDoc.ShareTextClick(Sender: TObject); var FSharingService: IFMXShareSheetActionsService; begin inherited; //分享照片 TPlatformServices.Current.SupportsPlatformService(IFMXShareSheetActionsService, FSharingService); if FSharingService<>nil then begin FSharingService.Share(nil, '', ImageViewer1.Bitmap); end; end;
先上代码,Delphi 支持跨平台开发app,早就实现了标准的Action,用于拍照、分享等功能实现,如果不用这标准的Action,那怎么办呢?
按上面的代码即可,直接取得IFMXShareSheetActionsService实例,并调用Share方法。
需要引用两个单元:FMX.Platform, FMX.MediaLibrary;