Sharing Text via SMS in your iOS apps

Posted by on in Blogs
Delphi and RAD Studio XE4 provide support for Share Sheet, an iOS 6 feature for sharing text and images via social media, sending them to an AirPrint enabled printer, saving them back to the camera roll etc.

TShowShareSheetAction is the standard action for sharing images and text.

Images and text to be shared can be specified through the Bitmap and the TextMessage properties.

The screenshot below shows a simple implementation of this functionality that allows you to share text that the user has typed into a Memo using SMS.

TShowShareSheetAction will show the available sharing options depending on the type of content you are sharing. This means, that the options shown for Text are different than for a Bitmap.



In this example, I just placed an ActionList component onto my form. I assigned ShowShareSheetAction1 to my SpeedButton on the toolbar and setup an OnBeforeExecute event:

procedure TTextMessageForm.ShowShareSheetAction1BeforeExecute(Sender: TObject);
begin
ShowShareSheetAction1.TextMessage:= Memo1.Lines.Text;
end;






>> For an example on how to share bitmaps, please see this demo in our SourceForge directory.
-Sarina


About
Gold User, Rank: 5, Points: 558
Senior Product Manager, RAD Studio

Comments

  • Antoni D32590
    Antoni D32590 Wednesday, 19 April 2017

    Hi SArina, how do i prepopulate the To (as in the telephone number for the text message) with the telephone number from a label?

  • Please login first in order for you to submit comments
  • Page :
  • 1

Check out more tips and tricks in this development video: