TwitterGifComposer 0.1.1

TwitterGifComposer 0.1.1

测试已测试
Lang语言 SwiftSwift
许可 MIT
发布最新发布2015年9月
SPM支持 SPM

王正宏 维护。




TwitterGifComposer

用法

原生 iOS Twitter 组件不支持 GIF。如果需要发布 GIF,这个组件会很有帮助。

尽管这个项目不依赖于 FLAnimatedImage,但与它的配合会更好。

    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() { }

alt tag

要求

iOS 8.0

安装

TwitterGifComposer 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中:

pod "TwitterGifComposer"

安装

作者

zh-wang, [email protected]

许可

TwitterGifComposer 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。