I am using UIImagePickerController
to capture the image. Now I want to crop the image. I am using cameraOverlayView
method of UIImagePicker
but it does not allow to move my cropping view. I want my cropping view should be moveable and resizable so that user can select image portion to use.
I am using the following code:
UIImagePickerController *cameraPicker = [[UIImagePickerController alloc] init];
cameraPicker.delegate = self;
cameraPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
cameraPicker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
UIView *overlay = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
cameraPicker.cameraOverlayView =overlay;
cameraPicker.allowsEditing = NO;
[self presentViewController:cameraPicker animated:YES completion:nil];
Can anyone suggest what can I do?
- (void)pickphoto:(UIImagePickerControllerSourceType)sourceType
{
imagePicker = [[UIImagePickerController alloc] init];
imagePicker.navigationBar.tintColor=[UIColor blackColor];
imagePicker.navigationItem.title=@"Photo Albums";
imagePicker.AllowsEditing = TRUE;
imagePicker.delegate = self;
imagePicker.sourceType = sourceType;
[self presentModalViewController:imagePicker animated:YES];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo
{
_imageV.image = image;
_imageV.layer.borderColor=[UIColor whiteColor].CGColor;
_imageV.layer.borderWidth=1.0;
[imagePicker dismissModalViewControllerAnimated:YES];
}