【问题标题】:How to skip 'retake and use' option after captureing photo from camera从相机拍摄照片后如何跳过“重拍并使用”选项
【发布时间】:2023-03-05 17:46:01
【问题描述】:

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

我们使用了以下代码

    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];
}

【问题讨论】:

    标签: iphone ios objective-c camera


    【解决方案1】:

    此视图由 UIImagePickerController 类的 showsCameraControls 属性提供给您

    如果您将其设置为NO,您将看不到该屏幕,但您必须提供相机控件。

    您的替代方法是使用AVFoundation,这将使您在外观和性能方面具有完全的灵活性。虽然设置需要更多时间,但从长远来看会有所回报。

    【讨论】:

    【解决方案2】:

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

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

    所以我只是在加载到 superview 时隐藏这个按钮,并放置一个自定义快门按钮来发送 takePicture 消息

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

    记得在调用takePicture之前设置ShowsCameraControls跳过重拍和使用

    然后你可以做任何你想做的事

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

    【讨论】:

      【解决方案3】:

      怎么样?

      imagepicker.allowsEditing = 否

      【讨论】:

        猜你喜欢
        • 2016-11-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-07-16
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多