欢迎加入QQ讨论群258996829

加载和显示 APNG 图片的框架

发布时间:2016-03-11 20:35  回复:0  查看:3951  感兴趣:13  赞:0   最后回复:2016-03-11 20:35  

APNGKit 是一个用于加载和显示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()

相关开源代码

您还未登录,请先登录

热门帖子

最新帖子