Sulo
Sulo

Reputation: 93

Set a fixed width and height for the "CropRect" in Swift

I want to crop the image after capture or select an image from library. How to change the displayable frame size of UIImagePickerController crop area.

I attached an image to get an idea about my question When i capture or select image i get the red square frame. Actually what i want to do is resize the red square frame size to green square.

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)
    }
}

Upvotes: 4

Views: 983

Answers (1)

amar
amar

Reputation: 4343

As per my understanding it is not possible to set rect for UIImagePickerController edit mode. You can capture unedited image and crop it your self or you can use TOCropViewController its nice. Picker only crops 320X320.

Upvotes: 2

Related Questions