繁体   English   中英

如何在UIImagePickerController的Editing View上设置Custom overlay视图?

[英]How to set Custom overlay view on Editing View of UIImagePickerController?

所有

我创建了具有委托的UIImagePickerController并从PhotoLibrary中选择图像。

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

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

在取消按钮上单击

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

这个鳕鱼工作正常。

但是,如果我在此处设置代码,则choose按钮不起作用,

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

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

还有其他方法可以在Editing ImagePicker上设置叠加视图吗?

问候,

试试这个代码

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

    }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM