简体   繁体   中英

Camera Preview inside Window with iPhone

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];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM