我想出现在用“ViewController”拍摄的“PreviewViewController”图片的“UIImageView”中。
但是我不能。
请告诉我
视图控制器.m
-(void)imagePickerController:(UIImagePickerController *)pic didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[imagePicker dismissViewControllerAnimated:YES completion:NO];
UIImage *originalImage;
originalImage = [info objectForKey:UIImagePickerControllerOriginalImage];
CGSize size = { 100, 200 };
UIGraphicsBeginImageContext(size);
CGRect rect;
rect.origin = CGPointZero;
rect.size = size;
[originalImage drawInRect:rect];
UIImage* shrinkedImage;
shrinkedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
CGRect r = CGRectMake(0, 60, 100, 100);
CGImageRef cgImage = CGImageCreateWithImageInRect(shrinkedImage.CGImage, r);
iconImage = [UIImage imageWithCGImage:cgImage];
UIImageWriteToSavedPhotosAlbum (iconImage, nil, nil , nil);
// This problem!!!
PreviewViewController *p = [[PreviewViewController alloc] init];
p.imagePreview.image = iconImage;
[self presentViewController:p animated:YES completion:NO];
}
PreviewViewController.h
@property (nonatomic) UIImageView *imagePreview;