iphone - 如何在同一 View 中打开相机

标签 iphone ios ipad

我正在创建一个应用程序,我需要在一个页面中有一个按钮和一个 View 。 当我单击该按钮时,我只想在该 View 中打开相机,而不是相机的单独 View 。是否可以? 如果是,请给我一些提示或代码。 谢谢。

最佳答案

是的,在 iOS 4+ 中可以使用 AVCaptureSession framework 。 像:

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

您可以找到更多帮助here .

关于iphone - 如何在同一 View 中打开相机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9834136/

相关文章:

ios - 如何将 xib 转换为 Storyboard?

objective-c - 在 xcode Storyboard中隐藏键盘

iphone - 如何使UIPickerView像UIDatePicker一样?

iphone - ios UITableView删除/重新排列编辑模式但不显示删除图标

iphone - 如何实现在字典数组中搜索字符串?

ios - 将数据传递给 ViewController 问题

ios - Cordova 不适用于 iOS 多目标

iphone - 没有符号的 NSNumberFormatter 货币?

iphone - UITableViewCell 重用良好实践

iphone - 如何在iPhone应用程序中将搜索索引添加到sqlite数据库