[英]Value of Type 'UIImage' Has No Member
The error I am getting says: 我得到的错误说:
Value of Type 'UIImage' Has no Member 'thumbnailImage'
类型'UIImage'的值没有成员'thumbnailImage'
I have searched other questions and solutions but I don't understand how to implement them into my code. 我搜索了其他问题和解决方案,但不了解如何在我的代码中实现它们。 Please help me out in solving this problem.
请帮我解决这个问题。
let image = UIImage(data: newProfilePictureData)
let mediumImage: UIImage = image!.thumbnailImage(280, transparentBorder: 0, cornerRadius: 0, interpolationQuality: CGInterpolationQuality.High)
let smallRoundedImage: UIImage = image!.thumbnailImage(64, transparentBorder: 0, cornerRadius: 0, interpolationQuality: CGInterpolationQuality.Low)
This is how you can generate thumb image from the original Image: 这是从原始图像生成拇指图像的方法:
func generateThumbImage() -> UIImage{
let image: UIImage = UIImage(data: newProfilePictureData)
let thumbSize = CGSizeMake(100, 100)
UIGraphicsBeginImageContext(thumbSize)
image.drawInRect(CGRectMake(0, 0, thumbSize.width, thumbSize.height))
let thumbImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return thumbImage
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.