I write an article in this blog for the first time.
This is based on the following my article. qiita.com
I'd like to brush up my poor English. If there are some mistakes in my English, please feel free to correct them.
- I use Instagram on my personal life, so I tried coding.
- It seems that few libraries have only this function.
- I'd like to introduce my library.
UIDocumentInteractionController to give it to Instagram app.
On your application
Info.plist, add the
Write your image data to a file in
let imageData = UIImageJPEGRepresentation(YourImage, 1.0) let temporaryDirectory = NSTemporaryDirectory() as NSString let temporaryImagePath = temporaryDirectory.stringByAppendingPathComponent("YourImageFileName.igo") let boolValue = imageData.writeToFile(temporaryImagePath, atomically: true)
Create an instance of the
lazy private var documentInteractionController = UIDocumentInteractionController()
URL property and the
UTI property, and call the
presentOpenInMenuFromRect method to display the menu.
documentInteractionController.URL = temporaryImagePath documentInteractionController.UTI = "com.instagram.exclusivegram" documentInteractionController.presentOpenInMenuFromRect( YourView.bounds, inView: YourView, animated: true )
Introduction my library
This library has functions at the very least, but I'd like to announce right now not to make mistakes.
I've referenced the following articles. Thanks!
Related to Instagram
Related to Carthage
Related to CocoaPods
I've used the following Web application for creating an animation GIF. Thanks!