[英]adding a subview displaying front facing camera in iphone
I want to add a mirro subview using the front facing camera using the iphone. 我想使用iPhone的前置摄像头添加mirro子视图。 How do I do that? 我怎么做? As I am new to iphone programming, I have some difficulty in using and configuring the UIImagePickerViewController. 由于我不熟悉iPhone编程,因此在使用和配置UIImagePickerViewController时遇到了一些困难。 This is what I have so far. 到目前为止,这就是我所拥有的。 But I am not quite sure how to set up the delegate. 但是我不太确定如何设置代表。 And is it correct to use UIView instead of UIImageView? 并且使用UIView代替UIImageView是否正确?
my .h file 我的.h文件
@interface myViewController : UIViewController <UIImagePickerControllerDelegate> {
//front facing camera view
UIImagePickerController *imageCameraController;
IBOutlet UIView *viewFrontFacingCamera;
}
and implementation 和实施
- (void)viewDidLoad {
[super viewDidLoad];
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]&&[UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceFront]){
imageCameraController = [[UIImagePickerController alloc] init];
imageCameraController.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType: UIImagePickerControllerSourceTypeCamera];
imageCameraController.cameraDevice = UIImagePickerControllerCameraDeviceFront;
imageCameraController.delegate=viewFrontFacingCamera????
viewFrontFacingCamera =imageCameraController.view;
}
}
Thanks! 谢谢!
Check out the link image picker . 检查链接图像选择器 。 It shows how to open image gallery or camera? 它显示了如何打开图库或照相机?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.