Я снимаю один кадр, используя
- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection
Теперь я хочу увидеть это изображение на другом UIViewController, который представляет,
но это не работает Я могу отобразить снятое изображение на том же UIViewController, но на другом оно, кажется, выходит за рамки.
Я пробовал это так:
В методе captureOutput:
CFRetain(sampleBuffer);
[photoView addFoto:sampleBuffer];
[self performSelectorOnMainThread:@selector(showPhoto:) withObject:nil waitUntilDone:YES];
CFRelease(sampleBuffer);
photoView - это другой UIViewController
- (void) addFoto:(CMSampleBufferRef) ref
{
UIImage *theImage = imageFromSampleBuffer(ref);
theImage = [[UIImage alloc] initWithCGImage:CGImageCreateCopy(theImage.CGImage)];
capturedImages = [NSMutableArray array];
[capturedImages addObject:theImage];
}
- (void) showPhoto:(UIImage*) bild
{
[session stopRunning];
photoView.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:photoView animated:YES];
}
и в методе viewDidLoad объекта PhotoView UIViewController:
- (void)viewDidLoad
{
[super viewDidLoad];
foto.image = [capturedImages objectAtIndex:0];
// Do any additional setup after loading the view from its nib.
}
Фотография UIImageView
Почему это не работает? Я в отчаянии...
Заранее спасибо.