小编ios*_*net的帖子

如何在 iOS/ swift 中上传图像时删除裁剪选项

这是带有裁剪选项的图像。

在此输入图像描述

我想删除此裁剪选项并上传完整长度的图像。可以使用iOS图像选择器吗?

当我要从照片库上传图像时,它会显示裁剪选项。我不想要裁剪选项。我想上传完整图像而不裁剪它。如何删除该裁剪选项?是否可以?请帮忙。我使用了以下代码,但它不起作用:

 @IBAction func clickImageUpload(_ sender: Any)
{

    let actionSheet = UIAlertController(title: nil, message: "Choose an Option", preferredStyle: .actionSheet)

    actionSheet.addAction(UIAlertAction(title: "Choose from Gallery", style: .default, handler: {
        (alert: UIAlertAction!) -> Void in

        self.imagePickerController.allowsEditing = true
        self.imagePickerController.sourceType = UIImagePickerControllerSourceType.photoLibrary
        self.imagePickerController.delegate = self

        self.present(self.imagePickerController, animated: true, completion: nil)
    }))

    actionSheet.addAction(UIAlertAction(title: "Take a Photo", style: .default, handler: {
        (alert: UIAlertAction!) -> Void in
        if UIImagePickerController.isSourceTypeAvailable(.camera) {
            self.imagePickerController.allowsEditing = true
            self.imagePickerController.sourceType = UIImagePickerControllerSourceType.camera
            self.imagePickerController.delegate = self

            self.present(self.imagePickerController, animated: true, completion: nil)
        }
        else{ …
Run Code Online (Sandbox Code Playgroud)

ios swift

6
推荐指数
1
解决办法
2154
查看次数

标签 统计

ios ×1

swift ×1