title: Is there any way to pass a PFFile (image) to another controller and display it without querying the database in the new controller?
body: <p>This is a question I have asked over at Parse forums and I have not had any reply from them for the past 3 days. Hence I am posting here. </p>
  
  <p>Hi,</p>
  
  <p>I have a PFQueryTableViewController and the table has custom cells with images and different labels. This Table navigates to another DetailViewController on the selection of a row. The DetailViewController need to display an image in its view, which we acquire from our query to the Parse database in the PFQueryTableViewController. How do I achieve that ?</p>
  
  <p><strong>TABLEVIEWCONTROLLER.M</strong></p>
  
  <pre><code>@interface TableViewController ()
  
  @end
  
  NSMutableArray* detailObjects;
  DetObj* clickedObj;
  
  @implementation TableViewController
  
  - (void)objectsDidLoad:(NSError *)error {
      [super objectsDidLoad:error];
  
      // This method is called every time objects are loaded from Parse via the PFQuery
  
      for (PFObject* object in self.objects)
      {
          DetailObj* obj = [[DetailObj alloc ] init ];
          [obj setDetName:[object objectForKey:@"detName"]];
          [mov setDetImage:[object objectForKey:@"detImage"]];
          [detailObjects addObject:obj];
      }
  }
  
  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object
  {
      static NSString *CellIdentifier = @"upCell";
  
      customBigTableCell *cell = (customBigTableCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  
      if (cell == nil) {
          cell = [[customBigTableCell alloc] init];
      }
  
      cell.name.text = [object objectForKey:@"detName"];
      cell.image.file = [object objectForKey:@"detImage"];
  
      //this is essential for loading the image from the database
      [cell.image loadInBackground];
  
      return cell;
  }
  
  - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
      [super tableView:tableView didSelectRowAtIndexPath:indexPath];
  
      UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:[NSBundle mainBundle]];
  
      newDetailController* newController = [storyboard instantiateViewControllerWithIdentifier:@"Detail"];
  
      clickedObj = [[DetObj alloc] init];
  
      NSIndexPath* path = [self.tableView indexPathForSelectedRow];
  
      clickedObj = [detailObjects objectAtIndex:path.row];
  
      [newController setDetInfo:clickedObj];
  
      [[self navigationController] pushViewController:newController animated:YES];
  }
  </code></pre>
  
  <p>I have tried using a PFImageView as stated below in the DetailViewController. detailInfo is the object passed from the previous PFQueryTableViewController.</p>
  
  <p><strong>newDetailController.m</strong></p>
  
  <pre><code>- (void)viewDidLoad
  {
      [super viewDidLoad];
      // Do any additional setup after loading the view.
  
      PFImageView* detImage = [[PFImageView alloc] initWithFrame:CGRectMake(300,0,320,150)];
  
      PFFile* file = detailInfo.fullImage.file;
  
      detImage.file = file;
  
      [detImage loadInBackground];
  
      [self.view addSubview:detImage];
  
  }
  </code></pre>
  
  <p>But I have this error.</p>
  
  <p><code>reason: '-[PFFile file]: unrecognized selector sent to instance</code></p>
  
  <p>I dont want to query the database again to get the info I have already obtained in the previous controller.</p>
  
  <p>Thanks Andrew</p>