gpt4 book ai didi

ios - 如何使用 [camera takePhoto] 并使用 UIImagePicker 进行编辑 - UIImagePickerController.allowsEditing = YES

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:17:52 25 4
gpt4 key购买 nike

我会觉得自己很蠢,但我到处搜索都没有找到答案。我已经能够使用默认相机的控件调出“编辑” View 。但是我在它上面放了一个叠加层,我有一个 UIButton 连接到 IBAction 拍照,看起来像 [UIImagePickerController takePicture]。

但是,即使我将允许编辑设置为是,它也完全跳过了编辑部分。还有其他命令可以调用它吗?现在,它直接进入 didFinishPickingMediaWithInfo。

    camera.sourceType = UIImagePickerControllerSourceTypeCamera;
camera.cameraDevice = UIImagePickerControllerCameraDeviceRear;
camera.showsCameraControls = NO;
camera.navigationBarHidden = YES;
camera.toolbarHidden = YES;
camera.wantsFullScreenLayout = NO;
camera.allowsEditing = YES;
camera.cameraOverlayView = overlay;
[self presentViewController:camera animated:YES completion:nil];

然后在 IBAction 中

    [camera takePicture];

最佳答案

可能重复:UIImagePickerController does not show edit screen

根据 Apple 文档中的 takePicture: 方法:

Use this method in conjunction with a custom overlay view to initiate the programmatic capture of a still image. This supports taking more than one picture without leaving the interface, but requires that you hide the default image picker controls.

Calling this method while an image is being captured has no effect. You must wait until the associated delegate object receives an imagePickerController:didFinishPickingMediaWithInfo: message before you can capture another picture.

似乎这种方法(自定义覆盖)是为了由您自己管理而配置的。即使“allowsEditing = YES”,拍摄的照片也会直接发送到imagePickerController:didFinishPickingMediaWithInfo:。

基于此,如果我们想使用我们的自定义用户界面编辑拍摄的照片,我们应该为此目的创建一个相应的自定义编辑屏幕。

关于ios - 如何使用 [camera takePhoto] 并使用 UIImagePicker 进行编辑 - UIImagePickerController.allowsEditing = YES,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17184224/

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