-1

I found an easy way to display the camera feed, but it shows above my XIB. How can I put the feed in a View to display under the buttons and background?

Here's my code.

//ViewController.m

FaceCamViewer *viewer3 = [[FaceCamViewer alloc] initWithFrame:CGRectMake(0, 0, 320, 568)];
viewer3.cameraType = AVCaptureDevicePositionFront;

AVCaptureSession *session = [[AVCaptureSession alloc] init];
viewer3.session = session; 

viewer3.draggable = NO;

[viewer3 startFaceCam];
[self.view addSubview:viewer3];

How do I create a property to access this through the XIB?

https://github.com/ijason/FaceCamTest

Hector Lopez
  • 313
  • 3
  • 12

1 Answers1

1

You could add a simple UIView to your XIB file, place it where you like and create a property that belongs to it. (@property IBOutlet UIView *faceView;) Hook up the property with the View in Interface Builder and then do [self.faceView addSubview:viewer3];

Atomix
  • 13,427
  • 9
  • 38
  • 46
  • But now I have a UIView *faceView and FaceCamView *viewer3. How do I connect those two? – Hector Lopez Mar 14 '14 at 17:11
  • This: [self.faceView addSubview:viewer3]; Your viewer3 will then be displayed in your faceview, which will be placed behind your buttons, etc. – Atomix Mar 14 '14 at 17:26