我开发了一个应用程序,可以从unitl相机拍摄照片,在从他的代表那里收到我的解雇后,我解雇了,我收到了exc_bad_access,这里是代码:
声明并打开相机:
-(void)ScattaFoto{
UIImagePickerController *picke = [[UIImagePickerController alloc] init];
// Delegate is self
picke.delegate = self;
// Allow editing of image ?
picke.allowsEditing=NO;
if(TARGET_IPHONE_SIMULATOR) {
picke.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
}else{
picke.sourceType = UIImagePickerControllerSourceTypeCamera;
}
// Show image picker
[self presentModalViewController:picke animated:YES];
}
比委托事件:
- (void) imagePickerController:(UIImagePickerController *)picke didFinishPickingMediaWithInfo:(NSDictionary *)info
{
// Access the uncropped image from info dictionary
//UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
// [picker release];
[self dismissModalViewControllerAnimated: YES]; // Here i receive exc_bad_access
[picke release];
}
我穿上.h引用imagePickerControl的委托“UINavigationControllerDelegate,UIImagePickerControllerDelegate”
有人可以帮我吗?
最佳答案
- (void) imagePickerController:(UIImagePickerController *)picke didFinishPickingMediaWithInfo:(NSDictionary *)info{
[picke dismissModalViewControllerAnimated: YES];
}
关于ios - ios如何在使用后关闭UIImagePickerController,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9703949/