簡體   English   中英

為Swift中的“CropRect”設置固定的寬度和高度

[英]Set a fixed width and height for the “CropRect” in Swift

我想在捕獲后裁剪圖像或從庫中選擇圖像。 如何更改UIImagePickerController裁剪區域的可顯示框架大小。

我附上一張圖片來了解我的問題。當我捕捉或選擇圖像時,我得到了紅色方框。 實際上我想要做的是將紅色方框尺寸調整為綠色方塊。

看到這個圖像

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。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM