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;