我在主视图控制器中创建了一个简单的按钮。在调用imagePickerController并拍照后,我想将用户重定向到下一个视图控制器以继续处理图像。不知怎的,它总是返回我的主窗口。
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSString *mediaType = info[UIImagePickerControllerMediaType];
[self dismissViewControllerAnimated:YES completion:nil];
if ([mediaType isEqualToString:(NSString *)kUTTypeImage]) {
UIImage *image = info[UIImagePickerControllerOriginalImage];
_imageView.image = image;
if (_newMedia)
UIImageWriteToSavedPhotosAlbum(image,
self,
@selector(image:finishedSavingWithError:contextInfo:),
nil);
}
else if ([mediaType isEqualToString:(NSString *)kUTTypeMovie]) {
// Code here to support video if enabled
}
}
答案 0 :(得分:1)
为此你必须推动你的观点,如
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
...
if ([mediaType isEqualToString:(NSString *)kUTTypeImage]) {
...
YourImgViewController *imgProcessing = [[YourImgViewController alloc] initWithNibName:@"YourImgViewController" bundle:nil];
imgProcessing.selectedImageView.image = image;
[self.navigationController pushViewController:imgProcessing animated:YES];
}
else if ([mediaType isEqualToString:(NSString *)kUTTypeMovie]) {
// Code here to support video if enabled
}
}
非常简单!
您可以在此链接http://www.edumobile.org/iphone/how-to-make-an-app-2/tutorial-on-image-picker-controller-in-iphone/
上找到更多提示