Jam*_*ore 27 iphone uiimagepickercontroller
在[camera takePicture]相机准备好之前调用时,会发出以下消息:
UIImagePickerController: ignoring request to take picture; camera is not yet ready.
我怎么知道什么时候准备拍照?
[camera isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera] 总是返回true,即使它显然没有准备好.
All*_*ian 46
由于@djromero说,是使用的解决方案AVFoundation(但不是 代替的UIImagePickerController.你只用AVFoundation得到通知后).
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(cameraIsReady:)
name:AVCaptureSessionDidStartRunningNotification object:nil];
Run Code Online (Sandbox Code Playgroud)
然后,一旦相机准备就绪,您就收到了通知:
- (void)cameraIsReady:(NSNotification *)notification
{
NSLog(@"Camera is ready...");
// Whatever
}
Run Code Online (Sandbox Code Playgroud)
我刚刚takePicture在UIImagePickerController演示后调用它(我得到了'相机没有准备好'的消息)并在我的通知回调中进行了测试,它就像一个魅力.
旁注:
[camera isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]总是返回,Yes因为它只检查是否有可用的摄像头设备.事实上,在您尝试初始化和呈现控制器之前,Apple建议您始终必须检查此返回Yes并且您具有非零委托(dismiss通过标准接口提供选择器的方法).
| 归档时间: |
|
| 查看次数: |
9389 次 |
| 最近记录: |