如何在拍摄照片后跳过“重新拍摄和使用”选项

8

输入图像描述

如何在拍照后跳过“重新拍摄并使用”选项,或者如何更改这些按钮的字体和颜色。

我们使用了以下代码

    self.gimgPicker = [[GKImagePicker alloc] init];
    self.gimgPicker.cropSize = CGSizeMake(310, 310);
    self.gimgPicker.delegate = self;
    self.gimgPicker.desiredSize = CGSizeMake(640, 640);
    imgPicker = [[UIImagePickerController alloc] init];
            // Set type to Photo Library if button at index is selected
            if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) {

                self.gimgPicker.imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
                [parentController presentModalViewController:self.gimgPicker.imagePickerController animated:YES];
}
3个回答

3
这个视图是由UIImagePickerController类的showsCameraControls属性呈现的。
如果将其设置为NO,您将不会看到该屏幕,但是您需要提供相机控件。
您可以选择使用AVFoundation,这样您就可以完全自定义外观和功能。虽然设置需要更多时间,但长远来看会收到回报。

为了更清晰地说明,我找到了这个演示 https://guides.codepath.com/ios/Creating-a-Custom-Camera-View 这里也有代码库 https://github.com/lteu/demo_AVFoundation - tong

0

我使用 swizzle 来解决这个问题,虽然有点 hack...

使用 reveal 我知道快门按钮的类名是 CAMShutterButton,它是 UIButton 的子类

所以当它加载到 superview 时,我只需隐藏此按钮,并放置一个自定义的快门按钮来发送 takePicture 消息

既然我可以隐藏它,我实际上可以为此按钮添加目标操作或使用通知

在调用 takePicture 之前记得设置 setShowsCameraControls,以跳过重拍并使用

camera without shutter button

然后你可以在其中做任何你想做的事情

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info

0

这个怎么样?

imagepicker.allowsEditing = NO


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接