2012-06-16 115 views
1

全部如何在编辑UIImagePickerController的视图上设置自定义覆盖视图?

我已经用委托创建了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

ü可以让我们知道选择按钮的功能是什么? – Ananth

+0

选择与编辑UIImagePickerViewController中的选择按钮完全相同的按钮。 –

回答

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

    } 
+0

源类型应该是不PhotoLibrary相机.. –

+0

使用本imagePickerController.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum; – Deepesh

+0

我已经做到了,看到我上面的代码.. –

相关问题