【发布时间】:2015-03-31 13:18:59
【问题描述】:
在我的图像选择器中,我使用了以下代码
- (void)imageAtIndex:(NSInteger)index completionHandler:(void(^)(UIImage *image))completionHandler
{
NSDictionary *image = self.images[index];
[self.library assetForURL:image[@"URL"] resultBlock:^(ALAsset *asset) {
ALAssetRepresentation *representation = [asset defaultRepresentation];
UIImage *returnImage = [UIImage imageWithCGImage:[representation fullResolutionImage]
scale:[representation scale]
orientation:(int)[representation orientation]];
completionHandler(returnImage);
} failureBlock:^(NSError *error) {
NSLog(@"Error loading asset");
}];
}
我使用以下代码选择图像
[self.cameraRoll imageAtIndex:indexPath.row-1 completionHandler:^(UIImage *image) {
myImage=image;
}];
当我第一次选择时,当我第二次选择相同的图像时,它给出的值为“nil”,它正确地选择了图像。
如何解决这个问题。
【问题讨论】:
标签: ios uiimagepickercontroller