Why tableview didn’t show the correct image?

I have two Viewcontroller A and B. A will download all the photo in collectionview then I can click on single cell to go to Viewcontroller B which is the tableview to show only this single image that passed from A.

But its working fine when first lunch the app but once I add new photo in the collectionview then I clicked this new photo to go to Viewcontroller B but B didn’t show the correct photo showing some other photo. I print out the photo data postImg in viewcronller A and B the data is the same but B is not showing the correct photo. Why? When I rebuild the program it’s working the issues seems only happened when I add new photo.

Here is code to load the pic from server

func loadPosts(){

        let query = PFQuery(className: "posts")
        query.whereKey("username", equalTo:PFUser.current()!.username!) 
        query.skip = self.picArray.count // skip the already loaded images

        query.findObjectsInBackground { (objects, error) in

            if error == nil {

             if let objects  = objects{ 
                for object in objects{       
                    self.collectionView?.performBatchUpdates({
                        let indexPath = IndexPath(row: self.uuidArray.count, section: 0)
                        self.uuidArray.append(object.value(forKey: "uuid") as! String)
                        self.picArray.append(object.value(forKey: "pic") as! PFFile)
                        self.collectionView?.insertItems(at: [indexPath])
                    }, completion: nil)

                }
              }
            } else{
                print(error!.localizedDescription)
            }
        }
     }

Then var postImgData = [UIImage]() is the array used to save all the photos that downloaded from above function and this viable is defined at beginning of CLASS Viewcontroll A.

override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
    return picArray.count
}

override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
    //define cell

    let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as! pictureCell


        picArray[indexPath.row].getDataInBackground { (data, error) in

            if error == nil {
                cell.picImg.image = UIImage(data: data!)
                self.postImgData.append(UIImage(data: data!)!)


            } else {
                print(error!.localizedDescription)
            }
        }
        return cell
    }

Then i click the cell to go to viewcontroller B . postImg is defined at beginning of Viewcontroller B as global viable to get the image date that you click on Viewcontroller A cell.

override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
    postImg = postImgData[indexPath.row]
    let post = storyboard?.instantiateViewController(withIdentifier: "postVC") as! postVC
    self.navigationController?.pushViewController(post, animated: true)

}

Then in Viewcotnroller B to show the photo

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! postCell

    cell.picImg.image = postImg

    return cell
}

Why tableview didn’t show the correct image?