是否有可能有一系列图像(png)可以放置在应用程序中拍摄的图像的顶部,或者在应用程序中处于相机模式时仅出现在屏幕上?即门或壁纸样品。
如果是这样,如何实现?
感谢您提供的任何帮助:)
UIImagePickerController
有财产cameraOverlayView
UIView
。将它分配给您想要在相机顶部的任何内容。
从文档:
您可以使用覆盖视图在默认图像选择器界面的顶部呈现自定义视图层次结构。图像选择器将您的自定义覆盖视图分层放置在其他图像选择器视图之上,并将其相对于屏幕坐标定位。如果您将默认相机控件设置为可见,请将透明度合并到您的视图中,或将其放置以避免遮挡底层内容。
这可能会对您有所帮助。
-(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];
}
}