gpt4 book ai didi

ios - 无法从 didFinishPickingMediaWithInfo 进行显式方法调用

转载 作者:行者123 更新时间:2023-11-28 22:01:15 25 4
gpt4 key购买 nike

我有一个带有四个选项卡的 tabBar 应用程序。每个选项卡在每个选项卡 View 的 UINavigationBar 左侧都有一个相机按钮。单击相机按钮,进入相机模式,拍照,最后选择“使用照片”后,图片应传输到不同的 ViewController 并放置在 UIImageView 中,该方法仅在方法后显示名为 attachButtonInvoked 的事件被触发。这是我的方法,请忽略注释行:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
//UIImage * image = [info objectForKey:UIImagePickerControllerEditedImage];
//[picker dismissViewControllerAnimated:NO completion:nil];


UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
//UIImageWriteToSavedPhotosAlbum(image,nil,nil,nil);

RGPostTableViewController *postTableView = [self.storyboard instantiateViewControllerWithIdentifier:@"postTableView"];
RGPostViewController *postView = [self.storyboard instantiateViewControllerWithIdentifier:@"postView"];
UINavigationController *postControl = [self.storyboard instantiateViewControllerWithIdentifier:@"postControl"];



//postView.postImageView.image = image;

//[picker dismissViewControllerAnimated:NO completion:nil];

[picker presentViewController:postControl animated:YES completion:nil];

NSLog(@"%@", image);

[postTableView attachButtonInvoked];
postView.postImageView.image = image;

}

到目前为止,我正在获取图像。但是我无法成功调用attachButtonInvoked;它不会显示 UIImageView 和设置图片。

最佳答案

看起来你可能在这里实例化了新的 View Controller

RGPostTableViewController *postTableView = [self.storyboard instantiateViewControllerWithIdentifier:@"postTableView"];
RGPostViewController *postView = [self.storyboard instantiateViewControllerWithIdentifier:@"postView"];
UINavigationController *postControl = [self.storyboard instantiateViewControllerWithIdentifier:@"postControl"];

而不是使用已经创建的。相反,尝试获取对那些已经实例化的 View Controller 的引用,以便您可以在 ImageView 上设置图像。

关于ios - 无法从 didFinishPickingMediaWithInfo 进行显式方法调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25028121/

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