我正在使用this tutorial来捕获AVFoundation的图像。我正在尝试将捕获的图像从CaptureSessionManager(一个NSObject类)返回到AROverlayViewController。我该怎么做呢?
我尝试将@property (nonatomic, retain) UIImage *finalImage;
放在AROverlayViewController.h中,然后在CaptureSessionManager.m中设置arController.finalImage = image;
,但日志说finalImage是null
。
有关如何最好地做到这一点的任何想法?谢谢!
答案 0 :(得分:2)
类 CaptureManager
上有一个属性@property (nonatomic, retain) UIImage *stillImage;
您可以通过此代码获取
UIImage *final = [captureManager stillImage];
答案 1 :(得分:0)
我终于明白了 - 在AROverlayViewController.m中添加UIImage *test = [captureManager stillImage];
。上帝,这让我永远。
答案 2 :(得分:0)
NSData *imageData;
- (void) imagePickerController: (UIImagePickerController*) reader
didFinishPickingMediaWithInfo: (NSDictionary*) info
{
[self performSelectorInBackground:@selector(showLoading) withObject:nil];
UIImage *capturedImage = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
imageData = [[NSData alloc]init];
imageData = UIImagePNGRepresentation(capturedImage);
[imageData retain];
[reader dismissModalViewControllerAnimated: YES];
}
您可以将此NSData传递给其他可以访问此图像的视图。