title: Displaying images from json file in tableview
body: <p>I have a json array and I am using the following to retrieve data:</p>
  
  <pre><code>- (void) retrieveData
  {
      NSURL * url = [NSURL URLWithString:getDataURL];
      NSData * data = [NSData dataWithContentsOfURL:url];
      jsonArray = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
  
      //set up cities array
      dronesArray = [[NSMutableArray alloc] init];
  
      //Loop json array
      for (int i = 0; i &lt; jsonArray.count; i++)
      {
          //Create city/drone object
          NSString * dID = [[jsonArray objectAtIndex:i] objectForKey:@"id"];
          NSString * dName = [[jsonArray objectAtIndex:i] objectForKey:@"droneName"];
          NSString * dPic = [[jsonArray objectAtIndex:i] objectForKey:@"dronePic"];
          [dronesArray addObject:[[City alloc]initWithDroneName:dName andDronePic:dPic]];
      }
  }
  </code></pre>
  
  <p>The above displays the cells fine:</p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
      static NSString *CellIdentifier = @"Cell";
      UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
  
      // Configure the cell...
  
      City * droneObject;
      droneObject = [dronesArray objectAtIndex:indexPath.row];
  
      cell.textLabel.text = droneObject.droneName;
  
      //Accessory
      cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
  
      return cell;
  }
  </code></pre>
  
  <p>But it only displays the Name, there is no image. The images are stored in URL format e.g. <a href="http://www.domain.com/image.jpg" rel="nofollow noreferrer">http://www.domain.com/image.jpg</a> in the sql database. How can I import the images to make it look like this format:</p>
  
  <p><img src="https://i.stack.imgur.com/Yat1y.png" alt="enter image description here"></p>
  
  <p>Ok So I added the following code to cellforrowatindexpath and it doesn't do anything:</p>
  
  <pre><code>[[cell imageView] setImage: [UIImage imageNamed:droneObject.dronePic]];
  </code></pre>