一個iOS高性能的GIF動畫引擎:XAnimatedImage

jopen 8年前發布 | 14K 次閱讀 iOS開發 移動開發 XAnimatedImage

XAnimatedImage是一個iOS高性能的GIF動畫引擎,采用Swift開發基于FLAnimatedImage
qq截圖20151203210845.png
An illustration is shown below:

XAnimatedImage playing multiple GIFs

特性

  • Plays multiple GIFs simultaneously with a playback speed comparable to desktop browsers
  • Honors variable frame delays
  • Eliminates delays or blocking during the first playback loop
  • Interprets the frame delays of fast GIFs the same way modern browsers do
  • </ul>

    Who is this for?

    • Apps that don't support animated GIFs yet
    • Apps that already support animated GIFs but want a higher performance solution
    • People who want to tinker with the code (the corresponding blog post describing the original FLAnimatedImage repo is a great place to start; also see the To Do section below)
    • </ul>

      Requirements

      • iOS 7.1+
      • Xcode 7.1+
      • </ul>

        Installation

        XAnimatedImage, like it's original counterpart FLAnimatedImage, is a well encapsulated drop-in component. Simply replace yourUIImageViewinstances with instances ofXAnimatedImageViewto get animated GIF support. There is no central cache or state to manage.

        Manually

        You can integrate XAnimatedImage into your project manually. You can do it by copying the "Classes" folder in your project (make sure that "Create groups" option is selected).

        Other

        Other installation methods are currently being integrated into the project. Currently, this repository supports only manual installation. Planned, future installation methods will include:

        • CocoaPods
        • Carthage

        Usage

        var animatedImage = XAnimatedImage(initWithAnimatedGIFData: NSData(contentsOfURL: NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("example", ofType: "gif")!))!)
        var animatedImageView = XAnimatedImageView()
        animatedImageView.animatedImage = animatedImage
        animatedImageView.frame = CGRectMake(0,0,100,100)
        self.view.addSubview(animatedImageView)

        項目主頁:http://www.baiduhome.net/lib/view/home/1449147791389

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!