IOS 7 Study - UIActivityViewController(Presenting Sharing Options)

时间:2021-04-22 21:02:58

You want to be able to allow your users to share content inside your apps with their
friends, through an interface, such as Facebook and Twitter.

IOS 7 Study - UIActivityViewController(Presenting Sharing Options)

Solution

Create an instance of the UIActivityViewController class and share your content
through this class.

eg: you have a text field where the user can enter text to be shared, and a
Share button right near it. When the user presses the Share button, you will simply pass
the text of the text field to your instance of the UIActivityViewController class. Here
is our code. We are writing this code for iPhone, so we will present our activity view
controller as a modal view controller.