UIImagePickerController没有触发委托方法didFinishPickingImage或didFinishPickingMediaWithInfo - iphone

时间:2011-03-24 18:37:42

标签: iphone uiimagepickercontroller

我在某些设备上遇到一个奇怪的问题UIImagePickerController没有触发委托方法didFinishPickingImage或didFinishPickingMediaWithInfo。

我已经在iphone 4上测试了应用程序iOS 4.1,iPod 4g和iphone 4.3应用程序运行正常,委托方法运行正常。

但是在某些设备上,iphone 3gs iOS 4.1和iphone 4 iOS 4.3这些事件都没有触发。

当我们按下USE按钮时,设备播放拍照声,然后显示图像进行编辑。

我还尝试在拍摄相机后禁用图像的编辑模式,但没有帮助。

任何人都可以帮助我,为什么会这样?

以下是我正在使用的代码:

-(void)startCamera
{
    picker = [[UIImagePickerController alloc] init];
    picker.allowsEditing = YES;
    picker.delegate = self;
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    picker.showsCameraControls = YES;
    [self presentModalViewController: picker animated: YES];
[picker release];
}

// IOS 4   
//- (void) imagePickerController: (UIImagePickerController*) pickerController didFinishPickingMediaWithInfo: (NSDictionary*) info  

// IOS 3  

- (void)imagePickerController:(UIImagePickerController *)pickerView didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo
{
    btnCamera.enabled = YES;
    hasTakenImage = YES;
    btnRetake.hidden = NO;
    btnUpload.hidden = NO;
//    imgItem.image = [info objectForKey: UIImagePickerControllerOriginalImage];
    imgItem.image = image;
    // ADD: dismiss the controller (NB dismiss from the *reader*!)
    [pickerView dismissModalViewControllerAnimated: YES];
    [self dismissModalViewControllerAnimated: YES];
}

非常感谢

2 个答案:

答案 0 :(得分:-2)

我希望你在做什么

@interface  CameraOverlay1 : UIViewController < UIImagePickerControllerDelegate,UINavigationControllerDelegate>
在你的头文件中

....

答案 1 :(得分:-2)

尝试从[picker release];移除-(void)startCamera ..