iOS 多张图片合成
2020-06-14 本文已影响0人
gaookey
func imageSynthesis(_ arguments: [(UIImage, CGRect)], _ size: CGSize) -> UIImage {
UIGraphicsBeginImageContext(size);
for (image, rect) in arguments {
image.draw(in: rect)
}
guard let resultImage = UIGraphicsGetImageFromCurrentImageContext() else { return UIImage() }
UIGraphicsEndImageContext()
return resultImage;
}