开发者

Camera Preview inside Window with iPhone

开发者 https://www.devze.com 2022-12-15 10:43 出处:网络
I can launch a camera capture with UIImagePicker but capture process is done in another view. Is it possible to \'embed\' camera preview into the application window?

I can launch a camera capture with UIImagePicker but capture process is done in another view. Is it possible to 'embed' camera preview into the application window?

What I use is:

UIImagePickerController *picker;
开发者_开发问答picker = [[UIImagePickerController alloc]init];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.allowsImageEditing = YES;
picker.delegate = self;
[self presentModalViewController:picker animated:YES];


The closest you can come is to add a cameraOverlayView to the camera view and put a 'frame' around the picture. However, this will crop, rather than scale, the viewfinder.


You can add the preview as a subview like this:

[self.view addSubview:picker.view];
[picker viewWillAppear:YES];
[picker viewDidAppear:YES];
0

精彩评论

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

关注公众号