簡體   English   中英

無法從didFinishPickingMediaWithInfo進行顯式方法調用

[英]Cant make explicit method call from didFinishPickingMediaWithInfo

我有一個帶有四個標簽的tabBar應用。 每個選項卡在每個選項卡視圖的UINavigationBar的左側都有一個照相機按鈕。 單擊相機按鈕,進入相機模式,拍攝圖片並最終選擇“使用照片”后,應將圖片傳輸到其他ViewController並放置在UIImageView ,該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和設置圖片。

看來您可能在這里實例化新的視圖控制器

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

而不是使用已經創建的。 相反,請嘗試獲取對已實例化的視圖控制器的引用,以便可以在圖像視圖上設置圖像。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM