Skip to content

Swift图片选择器,对图片占用内存进行了优化

Notifications You must be signed in to change notification settings

fangjun123/Swift-

Repository files navigation

Swift-

Swift图片选择器,对图片占用内存进行了优化 //根据宽度计算高度 let height = width * size.height / size.width //按照宽高比绘制一张新的图片 let currentSize = CGSize(width: width, height: height) UIGraphicsBeginImageContext(currentSize) drawInRect(CGRect(origin: CGPointZero, size: currentSize)) let newImage = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() return newImage

About

Swift图片选择器,对图片占用内存进行了优化

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages