gpt4 book ai didi

ios - 使用相机 iOS 捕获和自定义裁剪图像

转载 作者:行者123 更新时间:2023-12-01 18:49:54 24 4
gpt4 key购买 nike

我正在使用 UIImagePickerController捕捉图像。现在我想裁剪图像。我正在使用 cameraOverlayView UIImagePicker的方法但它不允许移动我的裁剪 View 。我希望我的裁剪 View 应该是可移动的和可调整大小的,以便用户可以选择要使用的图像部分。
我正在使用以下代码:

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];

谁能建议我该怎么做?

最佳答案

- (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];
}

关于ios - 使用相机 iOS 捕获和自定义裁剪图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31964498/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com