gpt4 book ai didi

ios - [iOS][Objective-c] 图像选择器到下一个 Controller

转载 作者:行者123 更新时间:2023-12-01 16:25:44 24 4
gpt4 key购买 nike

- (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];
}

我想将图像发送到下一个 Controller 但出错

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UINavigationController imgMediaSelect]: unrecognized selector sent to instance 0x15979a00'



更新
我将 uiimagepickercontroller 方法移动到下一个 Controller

最佳答案

您的 didFinishPickingMediaWithInfo方法应该如下所示。在执行任何操作之前,您正在关闭您的 View 。

- (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];
}
}];
}

关于ios - [iOS][Objective-c] 图像选择器到下一个 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35479788/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com