[英][iOS][Objective-c] imagepicker to next controller
- (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];
}
I want to send image to next controller but error 我想将图像发送到下一个控制器但是出错
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UINavigationController imgMediaSelect]: unrecognized selector sent to instance 0x15979a00'
由于未捕获的异常“ NSInvalidArgumentException”而终止应用程序,原因:“-[UINavigationController imgMediaSelect]:无法识别的选择器已发送到实例0x15979a00”
UPDATE i move uiimagepickercontroller method to next controller 更新我将uiimagepickercontroller方法移动到下一个控制器
Your didFinishPickingMediaWithInfo
method should be like below. 您的
didFinishPickingMediaWithInfo
方法应如下所示。 You are dismissing your view before you perform any action. 在执行任何操作之前,您将关闭视图。
- (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];
}
}];
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.