Force UIImagePickerController to Crop a Square Image

后端 未结 2 941
不思量自难忘°
不思量自难忘° 2021-02-19 04:28

How do we force UIIImagePickerController to crop a square image?

I have searched all over and I haven\'t found a solid solution. Thankyo

var imagePicker         


        
2条回答
  •  眼角桃花
    2021-02-19 05:10

    For Swift 4

    func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
           viewController.dismiss(animated: true, completion: { () -> Void in
               if let image = info[UIImagePickerControllerEditedImage] as! UIImage {
                   yourUIImageView.image = image
               }
           })
    }
    

提交回复
热议问题