gpt4 book ai didi

uiimagepickercontroller - 拍照后无法选择使用照片或重拍

转载 作者:行者123 更新时间:2023-12-04 01:38:10 37 4
gpt4 key购买 nike

所以我正在尝试为 iOS 7 更新一个应用程序,但我遇到了自定义叠加层的问题。叠加层是我用来构图的图像(实时和使用全分辨率版本在相机胶卷中构图最终结果)。问题是,现在在 iOS 7 下,覆盖层虽然在底部是透明的,但提供了对常规“拍照”按钮的访问,但由于某种原因不允许我点击“使用照片”或“重拍”按钮拍照后出现。这是调用 View Controller 的代码片段:

- (IBAction)takePhoto:(UIButton *)sender {

UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = NO;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.showsCameraControls = YES;

// Overlay Creation
UIView* overlayView = [[UIView alloc] initWithFrame:picker.view.frame];
overlayView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"PBOverlayView.png"]];
[overlayView.layer setOpaque:NO];
overlayView.opaque = NO;

picker.cameraOverlayView = overlayView;

[self presentViewController:picker animated:YES completion:NULL];

}

最佳答案

另一种方法可能是在 ImagePicker 更改状态时观察通知,并在您进入“使用照片”屏幕时移除(或禁用)您的叠加层。

- (void) addPhotoObservers {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(removeCameraOverlay) name:@"_UIImagePickerControllerUserDidCaptureItem" object:nil ];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addCameraOverlay) name:@"_UIImagePickerControllerUserDidRejectItem" object:nil ];
}

- (void) removePhotoObservers {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}

-(void)addCameraOverlay {
if (self.cameraPicker) {
self.cameraPicker.cameraOverlayView = self.myCameraOverlayView;
}
}

-(void)removeCameraOverlay {
if (self.cameraPicker) {
self.cameraPicker.cameraOverlayView = nil;
}
}

关于uiimagepickercontroller - 拍照后无法选择使用照片或重拍,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19018658/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com