所有
我创建了带有委托的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值。
是否可以通过其他方式在编辑ImagePicker上设置叠加视图?
此致
答案 0 :(得分: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];
}