是否可以将一系列图像(png)定位在应用程序中拍摄的图像的顶部,或者在应用程序中以相机模式显示在屏幕上?即门或壁纸样品。
如果是这样,怎么可能实现呢?
感谢您提供的任何帮助:)
答案 0 :(得分:2)
UIImagePickerController
具有cameraOverlayView
UIView
属性。将它分配给相机顶部的任何内容。
来自文档:
您可以使用叠加视图在默认图像选取器界面上显示自定义视图层次结构。图像选择器将自定义叠加视图分层放在其他图像选取器视图的顶部,并将其相对于屏幕坐标定位。如果您将默认相机控件设置为可见,请将透明度合并到视图中,或者将其放置以避免模糊底层内容。
答案 1 :(得分:0)
这可能会对你有帮助。
-(IBAction)loadCameraView:(id)sender
{
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
[imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
if ([UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceFront])
{
[imagePicker setCameraDevice:UIImagePickerControllerCameraDeviceFront];
}
else
{
[imagePicker setCameraDevice:UIImagePickerControllerCameraDeviceRear];
}
[imagePicker setCameraCaptureMode:UIImagePickerControllerCameraCaptureModePhoto];
[imagePicker setDelegate:self];
[self presentViewController:imagePicker animated:YES completion:nil];
}
else
{
UIAlertView *aview = [[UIAlertView alloc] initWithTitle:@"Camera Not Available" message:nil delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[aview show];
}
}