如果allowsEditing = NO,Picker不会返回任何图像

时间:2013-04-29 11:26:51

标签: ios objective-c cocoa-touch

如标题所示,如果我设置

imagePickerController.allowsEditing = YES;

imagePickerController.allowsEditing = NO

我没有返回图片?我搜索过SO并找不到确定的答案

    UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
    imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    imagePicker.delegate = self;
    imagePicker.allowsEditing = NO;
    [self.editController presentModalViewController:imagePicker animated:YES];


- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
  DebugLog(@"info dict: %@", info);
  [picker dismissModalViewControllerAnimated:YES];
  UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage];
  self.schemeLogo.backgroundColor = [UIColor whiteColor];
  self.schemeLogo.image = image;
  NSData *imageData1 = UIImagePNGRepresentation(image);
  NSString *path1 = [ICUtils pathForDocument:@"schemeLogo.png"];
  [imageData1 writeToFile:path1 atomically:NO];
}

1 个答案:

答案 0 :(得分:6)

已修复,需要

[info objectForKey:UIImagePickerControllerOriginalImage];