Sunday, 22 June 2014

UIDocumentInteractionController Tutorial


NOTE:  Swift Version of UIDocumentInteractionController


UIDocumentInteractionController - iOS
UIDocumentInteractionController is a powerful class available to iPhone developers that let developers to provide in app support to their users. For example a wallpaper application, that allows user's to save wallpaper images in their photos app of the device. For this purpose developer has two options

1). Save image to photo gallery programmatically

2). Present UIDocumentInteractionController to user which has inbuilt option to save image or send image to other apps that are capable of opening that particular document (in our case its an image).


 In this article we are going to learn about UIDocumentInteractionController implementation.

First create an instance of UIDocumentInteractionController , we will use interactionControllerWithURL method which require url of the file we are going to save or you can say want to send to other apps. Then we will set its delegate to self.

In your .h file create a property of  UIDocumentInteractionController instance.



in your .m file. in viewDidLoad or your button IBAction



 

  Source Code: Download Source code for UIDocumentInteractionController

   OUTPUT:

UIDocumentInteractionController - iOSUIDocumentInteractionController - iOS

UIDocumentInteractionController - iOS

In this post we learn about How to use UIDocumentInteractionController in iOS using Objective C language, you can check how to create UIDocumentInteractionController in iOS using swift language from below link

Swift Version of UIDocumentInteractionController

 





4 comments:
Write comments
  1. @Carona Williams, Yes you can share text with image but for that you have to create a new image that contains image(you want to share ) and text written below it by taking screenshot of the device screen programmatically and then share this new image using UIDocumentInteractionController.

    ReplyDelete
  2. fukall font style selection. i'm outta here :/

    ReplyDelete
  3. thnx for this fix

    ReplyDelete