ios - 在 Swift 中为 "CropRect"设置一个固定的宽度和高度

标签 ios iphone swift ipad

我想在拍摄后裁剪图像或从库中选择图像。如何更改 UIImagePickerController 裁剪区域的可显示框架大小。

我附上了一张图片以了解我的问题 当我捕获或选择图像时,我得到红色方框。实际上我想要做的是将红色方框大小调整为绿色方框。

See this image

func openGallary()
{
    picker!.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
    picker!.allowsEditing = true;
    picker!.delegate = self;
    if UIDevice.currentDevice().userInterfaceIdiom == .Phone
    {
        self.presentViewController(picker!, animated: true, completion: nil)
    }
    else
    {
        popover=UIPopoverController(contentViewController: picker!)
        popover!.presentPopoverFromRect(editPP.frame, inView: self.view, permittedArrowDirections: UIPopoverArrowDirection.Any, animated: true)
    }
}

最佳答案

据我所知,不可能为 UIImagePickerController 编辑模式设置 rect。您可以捕获未经编辑的图像并自行裁剪,也可以使用 TOCropViewController 这真好。 选择器仅裁剪 320X320。

关于ios - 在 Swift 中为 "CropRect"设置一个固定的宽度和高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34058983/

相关文章:

ios - iOS:AVCaptureSession录制的音频不会超过11秒

ios - 将 UIImageView 从 A 移动到 B

iphone - UIView 性能 : opaque, backgroundColor,clearsContextBeforeDrawing?

swift - 如何获取字符串中第一行的范围?

swift - 无法获取正确的时间 :minutes string from NSDate() in Swift

arrays - 如何遍历 Swift 中的对象数组?

ios - 错误 : Can't find a simulator to match with "iPhone 6s"

ios - 如何在 Swift 中更改 UICollectionView 的 targetContentOffset?

ios - Swift animateWithDuration Completion 在推送模态视图时运行?

iphone - Xcode "-[UIViewController _loadViewFromNibNamed:bundle:] loaded the nib but the view outlet was not set."错误