开发者

AVFoudationFramework: StillImageCapture: how to exit from AVFF?

I have a question or two about using AVFoundationFramework in XCode.

I downloaded AVCamDemo source code. I am trying to leverage the code in my app to replace UIImagePickerController (because it is slow) with the AVFF functionality. However, I cannot figure out how to exit the AVFF code when "Done" button is tapped in the UI. My app will provide the Done button.

Specifically, I need t开发者_如何转开发o know:

  1. What do i need to stop the capture session? Just [session stopRunning] ??

  2. My app's ViewController will invoke the AVFF, and will provide the "Done" button in the view controller that I will create for the AVFF functionality. When the user taps the "Done" button, I need to stop the capture process and exit back to my app. I am not sure how this can be done.

Any help will be highly appreciated.

Regards, Sam.


  1. Yes. Although you may also want to ensure you turn the video torch off if you had turned it on, and if you called lockForConfiguration on the device you should be sure to unlock it.
  2. There is no "exiting". If you presented your view controller using presentModalViewController:animated:, use dismissModalViewControllerAnimated:. If you pushed it onto a UINavigationController, pop it back off. If you did it some other way, dismiss it in the way appropriate for that method.


regarding your question on AVFoundationFramework:

I don't exactly understand what you are not succeeding to do. Some general options:

  1. [session stop] will stop capturing.

  2. You can play with the AVCaptureVideoPreviewLayer layer - that's what actually shows the camera preview.

  3. All the ui code is in AVCamViewController - so you can just pop it from the stack, or remove it from superview - which ever is correct in your code.

If these don't help, please try to elaborate further on the problem, and perhaps supply some code.

Cheers, Oded.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜