1

这就是我从相机中显示和保存的方式:

-(IBAction)Camera:(id)sender{
    if ([UIImagePickerController isSourceTypeAvailable:
         UIImagePickerControllerSourceTypeCamera])
    {
        UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
        imagePicker.delegate = self;
        imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
        imagePicker.mediaTypes = [NSArray arrayWithObjects: (NSString *) kUTTypeImage,nil];
        imagePicker.allowsEditing = NO;
        [self presentModalViewController:imagePicker animated:YES];

        newMedia = YES;
    }
}

-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {

    [self dismissModalViewControllerAnimated:YES];

    NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];

    if ([mediaType isEqualToString:(NSString *)kUTTypeImage]) {
        UIImage *image = [self scaleThenRotateImage:[info objectForKey:UIImagePickerControllerOriginalImage]];

        imageView.image = image;
        if (newMedia)
            UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:finishedSavingWithError:contextInfo:), nil);
    }

    else if ([mediaType isEqualToString:(NSString *)kUTTypeMovie]) {
        // Code here to support video if enabled
    }
}

但问题是,我正在使用一个选择器ALAsset,它可以多选然后在所选图像上显示一个复选标记。

因此,例如,我从我的相机(使用上面的代码)拍摄一张照片,然后转到我的相机胶卷以选择带有 的图像(多个/单个),imageTaken当我显示选择器时它不会显示任何复选标记,所以我假设解决方案是我需要通过/使用来保存它ALAsset

我应该改变这个:

UIImagePickerControllerOriginalImage

UIImagePickerControllerMediaMetadata

或者我应该做什么/改变?感谢您的回答。

4

0 回答 0