Native iOS twitter composer does NOT support gif. This composer will help if you need to post gifs.
Although this project does NOT rely on FLAnimatedImage, but it can do better with it.
class ViewController: UIViewController, TwitterGifComposerDelegate {
/* ... */
@IBAction func touchUpInside(sender: AnyObject) {
var path = NSBundle.mainBundle().pathForResource("abc", ofType: "gif")
var data = NSData(contentsOfFile: path!)
self.twitterGifComposer = TwitterGifComposer.defaultComposer(delegate: self, rootViewController: self).withText("Post Gif").withGifData(data!)
/*
The image view in composer only show static image, by default.
But if FLAnimatedImage is also imported, you can replace it as FLAnimatedImageView
*/
var animatedImageView = FLAnimatedImageView(frame: CGRectZero)
animatedImageView.animatedImage = FLAnimatedImage(GIFData: data!)
animatedImageView.startAnimating()
self.twitterGifComposer!.attachFLAnimatedImageView(animatedImageView)
/* show the composer */
self.twitterGifComposer!.show()
}
func onPostFailed() { }
func onPostSuccessed() { }
func onStopPost() { }
iOS 8.0
TwitterGifComposer is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "TwitterGifComposer"
zh-wang, viennakanon@gmail.com
TwitterGifComposer is available under the MIT license. See the LICENSE file for more info.