title: How to add images to UITableView cell?
body: <p>I temporarly added some values to the <code>UITableViewCell</code> programmatically. But I need to add images to each cell. How can I do that?</p>
  
  <p>Here is my code. .h file</p>
  
  <pre><code> @interface BidalertsViewController : UIViewController       &lt;UITableViewDelegate,UITableViewDataSource&gt; {
      NSArray *listData;
  }
  @property(nonatomic, retain) NSArray *listData; 
  @end
  </code></pre>
  
  <p>.m file</p>
  
  <pre><code> @synthesize listData;
  
  - (void)viewDidLoad {
  UIView *newView = [[UIView alloc] initWithFrame:CGRectMake(5,0,310,28)];
  newView.backgroundColor=[UIColor whiteColor];
  UITextView *mytext = [[UITextView alloc] initWithFrame:CGRectMake(0.0, 0.0, 100.0, 25.0)];
  mytext.backgroundColor = [UIColor clearColor];
  mytext.textColor = [UIColor blackColor];
  mytext.editable = NO;
  mytext.font = [UIFont systemFontOfSize:15];
  mytext.text = @"Asset Name";
  [mytext release];
  [newView addSubview:mytext];
  
  [self.view addSubview:newView];
  [newView release];
  
  
  NSArray *array = [[NSArray alloc] initWithObjects:@"iPhone", @"iPod", @"iPad",nil];
  self.listData = array;
  [array release];
  [super viewDidLoad];
  }
  - (void)didReceiveMemoryWarning {
       [super didReceiveMemoryWarning];
  }
   - (void)dealloc {
    [listData dealloc];
    [super dealloc];
  }
  
  
   - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
   {
  return [self.listData count];
   }
  
   - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  
  static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier";
  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier];
  if (cell == nil) { cell = [[[UITableViewCell alloc]
                              initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SimpleTableIdentifier] autorelease];
  }
  NSUInteger row = [indexPath row]; 
  cell.textLabel.text = [listData objectAtIndex:row]; 
  return cell;
  
  UIImageView *imv = [[UIImageView alloc]initWithFrame:CGRectMake(3,2, 20, 25)];
  imv.image=[UIImage imageNamed:@"user.jpg"];
  [cell.contentView addSubview:imv];
  [imv release];
   }
  @end
  </code></pre>
  
  <p>The code didn't add images to the cell. What's the problem? How can I do to add custom image to cell?</p>