1

全部

我已经使用委托创建 UIImagePickerController 并从 PhotoLibrary 中挑选图像。

imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType =  UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.delegate = self;
imagePicker.allowsEditing = YES;
[self presentModalViewController:imagePicker animated:YES];

当应用程序到达 UIImagePickerController 的编辑视图时,我设置了一个叠加视图并为其创建了两个按钮。 Cancel and Choose

在取消按钮上单击

[imagePicker popToViewController:[currentViewController.viewControllers objectAtIndex:1] animated:YES];

这条鳕鱼很好用。。

但是choose按钮不起作用,如果我在这里设置代码,

[self imagePickerController:imagePicker didFinishPickingMediaWithInfo:[imagePicker mediaTypes]];

比它返回信息字典的 NULL 值。

这是在 Editing ImagePicker 上设置覆盖视图的任何其他方式吗?

问候,

4

1 回答 1

0

试试这个代码

CustomOverlayView *CustomOverlayView = [[CustomOverlayView alloc] initWithFrame:CGRectZero];

    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
    {
        imagePickerController = [[UIImagePickerController alloc] init];
        imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;     
        imagePickerController.allowsEditing = NO;
        imagePickerController.delegate = self;
        imagePickerController.showsCameraControls = YES;
        [imagePickerController.view addSubview:CustomOverlayView];
        [self presentModalViewController:imagePickerController animated:YES];

    }
于 2012-06-16T12:13:41.180 回答