我得到了以下访问PHAsset的代码.我需要传递一个CG Image: let imageManager = PHImageManager.defaultManager()imageManager.requestImageDataForAsset(self.asset!, options: nil, resultHandler:{ (data, responseString, imageOriet,
let imageManager = PHImageManager.defaultManager() imageManager.requestImageDataForAsset(self.asset!, options: nil, resultHandler:{ (data, responseString, imageOriet, info) -> Void in let imageData: NSData = data! if let imageSource = CGImageSourceCreateWithData(imageData, nil) { let imageProperties = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, nil)! as NSDictionary //How do I create a CGImage now? } })
我需要提取一个CGImage.遇到麻烦……
获得图像源后,可以使用CGImageSourceCreateImageAtIndex创建图像:let image = CGImageSourceCreateImageAtIndex(imageSource, 0, nil)