[英]Trying to resize an image to a thumbnail, getting error “Use of unresolved identifier” for kCGInterpolationHigh
尝试使用以下代码将图像大小调整为缩略图,但出现错误:
使用未解决的标识符
对于kCGInterpolationHigh
@IBAction func dropPhoto(sender: AnyObject) {
presentViewController(imagePicker, animated: true, completion: nil)
}
func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage, editingInfo: [String : AnyObject]?) {
self.dismissViewControllerAnimated(true, completion: nil)
let thumbnail = image.resizedImageWithContentMode(UIViewContentMode.ScaleAspectFit, bounds: CGSizeMake(400, 400), interpolationQuality: kCGInterpolationHigh)
let imgData = UIImagePNGRepresentation(thumbnail)
}
}
在iOS 9+中使用CGInterpolationQuality.High
代替kCGInterpolationHigh
。
参考: https : //developer.apple.com/library/prerelease/ios/documentation/GraphicsImaging/Reference/CGContext/index.html#//apple_ref/c/tdef/CGInterpolationQuality
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.