歡迎加入QQ討論群258996829

加載和顯示 APNG 圖片的框架

發(fā)布時(shí)間:2016-03-11 20:35  回復(fù):0  查看:7517  感興趣:40  贊:2   最后回復(fù):2016-03-11 20:35  

APNGKit 是一個(gè)用于加載和顯示APNG圖片的高性能框架,它使用 Swift 編寫。

加載和顯示 APNG 圖片的框架

加載APNG圖片示例代碼:

// Load an APNG image from file in main bundle
var image = APNGImage(named: "your_image")

// Or
// Load an APNG image from file at specified path
var path = NSBundle.mainBundle().pathForResource("your_image", ofType: "apng")
if let path = path {
  image = APNGImage(contentsOfFile: path)  
}

// Or
// Load an APNG image from data
let data: NSData = ... // From disk or network or anywhere else.
image = APNGImage(data: data)
顯示APNG圖片示例代碼:

let image: APNGImage = ... // You already have an APNG image object.

let imageView = APNGImageView(image: image)
view.addSubview(imageView)

//And play the animation:
imageView.startAnimating()

相關(guān)開源代碼

您還未登錄,請先登錄

熱門帖子

最新帖子

?