0

I am creating an application in which i need that in one page there is a button and one view. When i click on that button i want to open camera in that view only not separate view of camera. Is it possible? And if yes, please provide me some hint or code. Thank you.

komal mehta
  • 269
  • 5
  • 14
  • If you read the documentation for UIImagePickerController you will get the answer. – Rahul Sharma Mar 23 '12 at 04:41
  • what's wrong with opening camera in another view controller, whether you can pass your delegate, and use it as in your own view, ammm.. may be you want to open camera in small area(in same view), If I am right the you can find your solution in this link http://stackoverflow.com/a/7319927/656600 – rptwsthi Mar 23 '12 at 04:50

1 Answers1

1

Yes its possible in iOS 4+ using the AVCaptureSession framework. like:

AVCaptureSession *session = [[AVCaptureSession alloc] init];
AVCaptureVideoPreviewLayer *previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:session];
previewLayer.frame = aFrame; 
[self.yourView.layer addSublayer:previewLayer];

You can find more help here.

Maulik
  • 19,348
  • 14
  • 82
  • 137
  • It is for video recording. Isn't it?? – komal mehta Mar 23 '12 at 04:53
  • 2
    You can capture still images with AV Foundation, not just video. See [AVCaptureStillImageOutput](http://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVCaptureStillImageOutput_Class/Reference/Reference.html#//apple_ref/occ/cl/AVCaptureStillImageOutput). – rickster Mar 23 '12 at 05:05