我正在努力捕获使用4.0返回的图像
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[[picker parentViewController] dismissModalViewControllerAnimated:YES];
// MediaType can be kUTTypeImage or kUTTypeMovie. If it's a movie then you
// can get the URL to the actual file itself. This example only looks for images.
//
NSString* mediaType = [info objectForKey:UIImagePickerControllerMediaType];
// NSString* videoUrl = [info objectForKey:UIImagePickerControllerMediaURL];
// Try getting the edited image first. If it doesn't exist then you get the
// original image.
//
if (CFStringCompare((CFStringRef) mediaType, kUTTypeImage, 0) == kCFCompareEqualTo) {
UIImage* picture …Run Code Online (Sandbox Code Playgroud) 我在这里看到了这个问题:UIImagePicker允许编辑卡在中心
似乎以前有人遇到过这个问题,但是没有明确的解决方案.
复制步骤:
我在iOS 7.0.3上.
这是我的代码:
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.modalPresentationStyle = UIModalPresentationCurrentContext;
imagePicker.allowsEditing = YES;
[self presentViewController:imagePicker animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud) 我已经读过它是自动的,但在我的情况下似乎没有发生.使用UImagePickerController并将allowEditing设置为YES我使用裁剪方形叠加获得我的编辑视图,但是当我完成图像时,它没有像我期望的那样被裁剪.
它应该在这个阶段自动吗?如果没有,那么在默认视图提供的匹配区域中裁剪图像可能是一个很好的解决方案?
谢谢.