我想在我的应用中添加相机功能,但默认的相机视图没有从库中选择图像的选项,我这样做是因为我不想为其制作警报视图用户选择图像选择器类型,即相机或照片库。如何实现这个??
UIImagePickerController *imagePicker = [[UIImagePickerController alloc]init];
[imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
imagePicker.showsCameraControls = NO;
imagePicker.navigationBarHidden = YES;
imagePicker.wantsFullScreenLayout = YES;
imagePicker.cameraOverlayView = overlayView;
答案 0 :(得分:2)
您创建的叠加视图在该overlayviewController中创建了一个委托,并且还将该委托方法附加到您的主视图中,因此当用户单击叠加视图按钮时,它将在主视图中调用一个函数。
@protocol OverLayViewControllerDelegate;
@protocol OverLayViewControllerDelegate
- (void)selectFromGallery;
- (void)selectFromCamera;
@end
然后根据方法调用设置图像选择器源。
答案 1 :(得分:0)
UIImagePickerController *imagePicker = [[UIImagePickerController alloc]init];
[imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];