title: TableView Navigation using JSON (database data)
body: <p>Good afternoon,</p>
  
  <p>I used the following tutorial to create a TableView Navigation: <a href="http://www.techotopia.com/index.php/Implementing_TableView_Navigation_using_Xcode_Storyboards" rel="nofollow">http://www.techotopia.com/index.php/Implementing_TableView_Navigation_using_Xcode_Storyboards</a> but with that example I can show static information.</p>
  
  <p>Now I need to display images and texts from my database and I need some help to do that.</p>
  
  <p>At the moment, that's my <strong>CarTableViewController.m</strong></p>
  
  <pre><code>#import "CarTableViewController.h"
  #import "CarTableViewCell.h"
  #import "CarTableViewController.h"
  #import "CarDetailViewController.h"
  
  @implementation CarTableViewController
  
  @synthesize carMakes = _carMakes;
  @synthesize carModels = _carModels;
  @synthesize carImages = _carImages;
  
  - (void)viewDidLoad
  {
      [super viewDidLoad];
      self.carMakes = [[NSArray alloc]
                       initWithObjects:@"Chevy",
                       @"BMW",
                       @"Toyota",
                       @"Volvo",
                       @"Smart", nil];
  
      self.carModels = [[NSArray alloc]
                        initWithObjects:@"Volt",
                        @"Mini",
                        @"Venza",
                        @"S60",
                        @"Fortwo", nil];
  
      self.carImages = [[NSArray alloc]
                        initWithObjects:@"chevy_volt.jpg",
                        @"mini_clubman.jpg",
                        @"toyota_venza.jpg",
                        @"volvo_s60.jpg",
                        @"smart_fortwo.jpg", nil];
  }
  
  - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  {
      // Return the number of sections.
      return 1;
  }
  
  - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  {
      // Return the number of rows in the section.
      return [self.carModels count];
  }
  
  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
      static NSString *CellIdentifier = @"carTableCell";
  
      CarTableViewCell *cell = [tableView
                                dequeueReusableCellWithIdentifier:CellIdentifier];
      if (cell == nil) {
          cell = [[CarTableViewCell alloc]
                  initWithStyle:UITableViewCellStyleDefault
                  reuseIdentifier:CellIdentifier];
      }
  
      // Configure the cell...
      cell.makeLabel.text = [self.carMakes
                             objectAtIndex: [indexPath row]];
  
      cell.modelLabel.text = [self.carModels
                              objectAtIndex:[indexPath row]];
  
      UIImage *carPhoto = [UIImage imageNamed:
                           [self.carImages objectAtIndex: [indexPath row]]];
  
      cell.carImage.image = carPhoto;
  
      return cell;
  }
  
  -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
  {
      if ([[segue identifier] isEqualToString:@"ShowCarDetails"])
      {
          CarDetailViewController *detailViewController =
          [segue destinationViewController];
  
          NSIndexPath *myIndexPath = [self.tableView
                                      indexPathForSelectedRow];
  
          detailViewController.carDetailModel = [[NSArray alloc]
                                                 initWithObjects: [self.carMakes
                                                                   objectAtIndex:[myIndexPath row]],
                                                 [self.carModels objectAtIndex:[myIndexPath row]],
                                                 [self.carImages objectAtIndex:[myIndexPath row]],
                                                 nil];
      }
  }
  
  @end
  </code></pre>
  
  <p>I need to put the information from my database (author, date and picture) to carMakes, carModels and carImages to display it. I can get the values from my PHP file with JSON, but I need some help with the NSArray with JSON result because I never used it.</p>
  
  <p>How can I do that?</p>
  
  <p>That's my JSON result:</p>
  
  <pre><code>[{"id":"15","user":"1","image":"http:\/\/farmaventas.es\/images\/farmaventaslogo.png","date":"2014-09-13"}]
  </code></pre>
  
  <p>Thanks in advance.</p>