现在出现两个问题,我想更新以前在iOS4.x.x及以下版本中运行良好的应用程序。在iOS5.0.1上运行的以前版本的应用程序可以工作但我没有更新相机功能周围的任何代码
相机 - 用户拍照后,您将获得标准的“重拍”或“使用”按钮。重新拍摄很好,但“使用”会导致应用冻结并崩溃。
相机胶卷 - 用户从相机胶卷中选择图像后,似乎没有任何内容发生。它实际上确实选择了 - 但现在你必须点击“取消”,图像出现在主窗口中。
在这两种情况下,调试窗口中都没有错误消息,所以不确定发生了什么。有问题的两个函数的代码:
//Camera Method//////////////////////////
- (IBAction) cameraDeviceAction {
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera] == YES) {
imgPicker = [[UIImagePickerController alloc] init];
imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imgPicker.delegate = self;
imgPicker.allowsImageEditing = NO;
if([ApplicationUtils getSystemVersionAsAnInteger] >= __IPHONE_3_1) {
if(cameraOverlayView == nil) {
cameraOverlayView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"photo_guideline_640x960.png"]];
cameraOverlayView.frame = CGRectMake(0, 0, 320, 431);
}
imgPicker.cameraOverlayView = cameraOverlayView;
}
[self presentModalViewController:imgPicker animated:YES];
}
}
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[self showBackdropScreen:[info objectForKey:@"UIImagePickerControllerOriginalImage"]];
}
//Photo Library Method //////////////////////////
- (IBAction) libraryAction {
imgPicker = [[UIImagePickerController alloc] init];
imgPicker.allowsImageEditing = NO;
imgPicker.delegate = self;
[self presentModalViewController:imgPicker animated:YES];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)editInfo {
[self showBackdropScreen : img];
}
我认为错误存在于某处,但请告诉我您的想法或者您是否需要更多文件。
谢谢!
答案 0 :(得分:0)
虽然这是一个老问题,但答案是:
使用[self dismissModalViewControllerAnimated:YES];在函数
中 - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info;
最后