![](/img/trans.png)
[英]Fixed width and height of the UIImage using Swift (AutoLayout)
[英]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.