在这里,我正在使用 IOS 7 开发一个应用程序,其中相机用于捕获图像。但在捕获图像后,它会显示重拍/使用照片选项。我希望在捕获图像后直接进入下一个屏幕而不显示默认重拍?使用照片选项。我用谷歌搜索了这个问题,但我没有得到正确的解决方案。请帮我解决这个问题。
提前致谢。
这是我在项目中使用的代码片段
-(void)StartCamera
{
if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Device has no camera" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
[myAlertView show];
}
else
{
picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = NO;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:picker animated:YES completion:NULL];
}
}
最佳答案
现货UIImagePickerControllerSourceTypeCamera
iOS 提供的这两个按钮都有。
实现您想要的一种方法是继续使用 UIImagePickerViewController
并设置showsCameraControls
至NO
.然后,使用 cameraOverlayView
提供您自己的用户界面为您的自定义叠加 View 。
self.picker.showsCameraControls = NO;
self.overlay = [[OverlayViewController alloc] initWithNibName:@"Overlay" bundle:nil];
self.overlay.pickerReference = self.picker;
self.picker.cameraOverlayView = self.overlay.view;
self.picker.delegate = self.overlay;
另一种方法是使用
AVFoundation
创建自己的相机 View 。
关于ios7 - 如何在 IOS 7 中通过相机捕获图像后跳过重拍/使用照片选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23887109/