title: How to add images in UITableViewCells programmatically in iOS
body: <p>I need to add different images in <code>UITableViewCells</code> programmatically. How can I do that. I am trying some code. But the images are not displayed in <code>UITableViewCells</code>.
  This is my code below.</p>
  
  <pre><code>-(void)viewDidLoad
  {
      arrImages=[[NSMutableArray alloc]initWithObjects:@"image.png",@"image2.png",@"image3.png",@"image4.png",@"image5.png",@"image6.png",@"image7.png",@"image8.png" nil];
  }
  
  -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
  
      static NSString *identifier=@"cell";
  
      UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
  
      if (cell == nil) 
  
      {
  
          cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"identifier"];
  
      }
  
      imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 48, 48)];
  
      cell.imageView.image = [UIImage imageNamed:[arrImages objectAtIndex:indexPath.row]];
  
      return cell;
  }
  </code></pre>