- (IBAction)sendPhoto:(id)sender {
[DinsowMiniLogger log:@"Image: %@", self.pickedImage];
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentViewController:picker animated:YES completion:nil];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissViewControllerAnimated:YES completion:nil];
[[self navigationController] dismissViewControllerAnimated:YES completion:nil];
self.selMediaItem = [self.storyboard instantiateViewControllerWithIdentifier:@"selectmedia"];
[self presentModalViewController:self.selMediaItem animated:YES];
self.selMediaItem.imgMediaSelect.image = [info objectForKey:UIImagePickerControllerOriginalImage];
}
我想将图像发送到下一个控制器,但错误
由于未捕获的异常而终止应用 ' NSInvalidArgumentException',原因:' - [UINavigationController imgMediaSelect]:无法识别的选择器发送到实例0x15979a00'
UPDATE 我将uiimagepickercontroller方法移动到下一个控制器
答案 0 :(得分:0)
您的didFinishPickingMediaWithInfo
方法应如下所示。在执行任何操作之前,您正在驳回您的观点。
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
UIImage *browsed_Image = [info objectForKey:UIImagePickerControllerOriginalImage];
[picker dismissViewControllerAnimated:YES completion:^{
if (browsed_Image) {
// You can store here your image in UIImage object or directly pass it to next controller.
[btn_UserImage setImage:browsed_Image forState:UIControlStateNormal];
}
}];
}