如何从相机拍摄照片后跳过“重拍和使用”选项

时间:2013-04-15 10:05:46

标签: iphone ios objective-c camera

enter image description here

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

我们使用了以下代码

    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 个答案:

答案 0 :(得分:3)

此视图由UIImagePickerController

showsCameraControls属性提供给您

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

您的另一种选择是使用AVFoundation,它可以让您充分灵活地了解其外观和效果。虽然设置需要更多时间,但从长远来看,它将获得回报。

答案 1 :(得分:0)

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

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

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

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

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

camera without shutter button

那么你可以做任何你想要的事情

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

答案 2 :(得分:0)

怎么样?

imagepicker.allowsEditing =否