swift获取gif的第一张图片

import ImageIO // 导入

func getFirstImageWithGIF() -> UIImage {
        let gifPathSource = NSBundle.mainBundle().pathForResource("22", ofType: "gif")
        let data = NSData.init(contentsOfFile: gifPathSource!)
        let source = CGImageSourceCreateWithData(data!, nil)
        let count = CGImageSourceGetCount(source!)
        var tmpArray = [UIImage]()
        for i in 0..

你可能感兴趣的:(swift获取gif的第一张图片)