[iOS][Objective-c]图像选择器到下一个控制器
我想将图像发送到下一个控制器,但出现错误 由于未捕获异常而终止应用程序 “NSInvalidArgumentException”,原因:'-[UINavigationController imgMediaSelect]:发送到实例0x15979a00'的无法识别的选择器 更新[iOS][Objective-c]图像选择器到下一个控制器,ios,objective-c,uiimagepickercontroller,Ios,Objective C,Uiimagepickercontroller,我想将图像发送到下一个控制器,但出现错误 由于未捕获异常而终止应用程序 “NSInvalidArgumentException”,原因:'-[UINavigationController imgMediaSelect]:发送到实例0x15979a00'的无法识别的选择器 更新 我将uiimagepickercontroller方法移动到下一个控制器您的完成了使用信息的PickingMediaWithInfo方法应该如下所示。在执行任何操作之前,您将放弃您的观点 - (IBAction)sendP
我将uiimagepickercontroller方法移动到下一个控制器您的
完成了使用信息的PickingMediaWithInfo
方法应该如下所示。在执行任何操作之前,您将放弃您的观点
- (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];
}
请显示定义imgMediaSelect的位置好吗?只需在下一个视图控制器中定义UIImage的属性,然后将图像分配给self.selMediaItem.imageProperty=[info objectForKey:UIImagePickerControllerOriginalImage];然后在下一个viewcontroller中显示图像。
- (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];
}
}];
}