📜  图像复制 swift 扩展 - Swift 代码示例

📅  最后修改于: 2022-03-11 15:01:01.987000             🧑  作者: Mango

代码示例1
extension UIImage {
    func clone() -> UIImage? {
        guard let originalCgImage = self.cgImage, let newCgImage = originalCgImage.copy() else {
            return nil
        }

        return UIImage(cgImage: newCgImage, scale: self.scale, orientation: self.imageOrientation)
    }
}