您的位置:首页 > 移动开发 > Swift

【Swift】iOS裁剪或者压缩后出现的白边问题

2016-06-15 13:03 603 查看
只需要将所有的CGFloat转化为NSInteger即可

func imageScaleSize(newSize:
CGSize) -> UIImage{

let width =
NSInteger(newSize.width)

let height =
NSInteger(newSize.height)

UIGraphicsBeginImageContext(CGSize(width: width, height: height));

self.drawInRect(CGRect(x:
0, y: 0, width: width, height: height))

let newImage =
UIGraphicsGetImageFromCurrentImageContext()

UIGraphicsEndImageContext();

return newImage;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: