我想我在最新的iOS 7中发现了一个bug,我运行了一个将Base设置为iOS 6.1的应用程序(可能还有更低的版本,还没有测试出来)。
我的照片库中有一张图片:http://i.imgur.com/7KUIGLt.jpg
我通过以下方式展示了一个UIImagePickerController:
UIImagePickerController *vc = [[UIImagePickerController alloc] init];
vc.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
vc.delegate = self;
vc.allowsEditing = YES;
[self presentViewController:vc animated:YES completion:nil];
我将选择的图像保存到我的桌面上(我正在模拟器上运行,但这也可以在设备上运行)
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
UIImage* outputImage = [info objectForKey:UIImagePickerControllerEditedImage];
if (outputImage == nil) {
outputImage = [info objectForKey:UIImagePickerControllerOriginalImage];
}
NSData *d = UIImagePNGRepresentation(outputImage);
[d writeToFile:@"/Users/Admin/Desktop/test.png" atomically:YES];
[self dismissViewControllerAnimated:YES completion:nil];
}
这是得到的图像:
注意右边的大黑棒。是什么引起的?
要复制这个,您需要:
注意:为了清楚起见,是实际图像的一部分。你看到的图像不是UIImageView的截图,而是保存到磁盘并上传到这里的实际图像.
发布于 2013-10-18 13:56:25
我认为,我们最终解决了类似的问题,从未直接要求编辑过的图像;询问原始图像和裁剪信息(UIImagePickerControllerCropRect
),然后自己裁剪。请注意,如果您自己裁剪,则需要担心源映像中的旋转。
您可能会发现这个问题的答案对于实现这个工作很有帮助。
发布于 2013-10-16 11:43:39
尝试以编程方式查找并更改模式(方面匹配、方面填充、缩放填充)。
发布于 2013-10-19 07:05:26
我在试着复制这个虫子。在模拟器,模拟器,64位和iPad迷你版上也没有运气.全部运行iOS 7.0。
我把你的代码放在我的应用程序里:
UIImage *image = [info valueForKey:UIImagePickerControllerEditedImage];
if (!image)
image = [info valueForKey:UIImagePickerControllerOriginalImage];
// Save photo to custom album only if taken by camera
if (picker.sourceType == UIImagePickerControllerSourceTypeCamera)
[ALAssetsLibrary saveImageToCustomAlbum:image
assetURL:[info valueForKey:UIImagePickerControllerReferenceURL]];
NSData *d = UIImagePNGRepresentation(image);
[d writeToFile:@"/Volumes/Alko/Temp/test.png" atomically:YES];
UIImageWriteToSavedPhotosAlbum(image, nil, NULL, nil);
[self setImage:image];
[self dismissPicker:picker];
[self photoPickerDidFinish];
并正确使用从http://i.imgur.com/7KUIGLt.jpg下载的图像。我认为你的应用程序有问题,而不是UIImagePickerController。
https://stackoverflow.com/questions/19397873
复制相似问题