iOS - how to implement crop image like default photo album?

后端 未结 4 880
眼角桃花
眼角桃花 2021-02-09 09:42

The default crop function in iPhone photo album

\"enter

Does any one know how to i

4条回答
  •  不知归路
    2021-02-09 10:37

    func cropImageZero(_ completionHandler: (_ img: UIImage)->()){
            let image = UIImage(named: "name")
            let rect = CGRect(x: 0, y: y, width: width, height: height)
            let cgImage = image?.cgImage!.cropping(to: rect)
            let imageNew = UIImage(cgImage: cgImage!)
            completionHandler(imageNew)
    }
    

    image cropping, in Swift 4,

    Bonnie's answer is useful

提交回复
热议问题