gpt4 book ai didi

ios - 从 UIImagePickerController 获取完整图像

转载 作者:行者123 更新时间:2023-11-28 18:59:05 24 4
gpt4 key购买 nike

我有一个 UIImagePickerController,每次我选择一个图像时,我都会得到图像的裁剪版本,我想要完整的图像,我该怎么做?

- (void)tapSelectAd:(id)sender
{

picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
picker.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:picker.sourceType];
picker.allowsEditing = YES;
picker.wantsFullScreenLayout = YES;


[self presentModalViewController:picker animated:YES];

}




- (void)imagePickerController:(UIImagePickerController *) Picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissModalViewControllerAnimated:YES];
UIImage *image=[info objectForKey:UIImagePickerControllerEditedImage];
selectedImage.image = image;
}

最佳答案

试试这个:您需要将 allowsEditing 设置为 NO 并在选择图像时使用 UIImagePickerControllerOriginalImage。

- (void)tapSelectAd:(id)sender
{
picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
picker.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:picker.sourceType];
picker.allowsEditing = NO;
picker.wantsFullScreenLayout = YES;

[self presentModalViewController:picker animated:YES];
}

- (void)imagePickerController:(UIImagePickerController *) Picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissModalViewControllerAnimated:YES];
UIImage *image=[info objectForKey:UIImagePickerControllerOriginalImage];
selectedImage.image = image;
}

关于ios - 从 UIImagePickerController 获取完整图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28255707/

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