title: ios - Objective-c only the first cell of UITableView doesnt show the label I added
body: <p>I'm trying to add number from 1 to 9 from plist to each cell in UITableView. However the first view shows nothing and 1 is shown in the second cell, 2 is shown in the third cell and so on. I did some tests by adding <code>NSLog(@"test");</code> inside <code>if(cell==nil)</code> but only 7 "test" is printed while there are 9 cells.. does that mean codes inside <code>if(cell==nil)</code> do not executed for the first and last cell? <br/>
  Anybody care to solve this problem? :(</p>
  
  <pre><code>// Customize the appearance of table view cells.
  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
  
      static NSString *CellIdentifier = @"Cell";
  
      UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
      if (cell == nil)
      {
          NSLog(@"hi");
          //cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
          cell = [self getCellContentView:CellIdentifier];
  
          //add another textfield
          NSString *rankpath = [[NSBundle mainBundle] pathForResource:@"Rankvalue" ofType:@"plist"];
          NSMutableArray* rank = [[NSMutableArray alloc] initWithContentsOfFile:rankpath];
          rankValue = [rank objectAtIndex:indexPath.row];
          rankLabel = (UILabel *)[cell viewWithTag:1];
  
          // Configure the cell(thumbnail).
          cell.textLabel.text = [self.stars objectAtIndex:indexPath.row];
          [cell.textLabel setFont:[UIFont fontWithName:@"ALBA" size:[@"25" intValue]]];
          NSString *filepath = [[NSBundle mainBundle] pathForResource:@"Filename" ofType:@"plist"];
          self.filename = [[NSMutableArray alloc] initWithContentsOfFile:filepath];
  
          //transparent cell
          cell.backgroundColor = [UIColor clearColor];
     }
     //label
     rankLabel.text = rankValue;
     //[rankLabel setFont:[UIFont fontWithName:@"austin power" size:[@"40" intValue]]];
     //rankLabel.textColor = [UIColor redColor];
  
     CGRect labelFrame = CGRectMake(220,70,50,40.0);
     [rankLabel setFrame:labelFrame];
  
     cell.imageView.image = [UIImage imageNamed:[self.filename objectAtIndex:indexPath.row]];
  
     //cell.imageView.image = [UIImage imageNamed:[self.filename objectAtIndex:indexPath.row]];
  
     return cell;
  }
  </code></pre>
  
  <p>Heres another method I added for subviews<br /></p>
  
  <pre><code>//new method for different text in each cell
  - (UITableViewCell *) getCellContentView:(NSString *)cellIdentifier
  {
  
      CGRect CellFrame = CGRectMake(0, 0, 320, 65);
      CGRect Label1Frame = CGRectMake(17,5,250,18);  
  
      UILabel *lblTemp;
  
      UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier] autorelease];
  
      //UITableViewCell *cell = [[[UITableViewCell alloc] initWithFrame:CellFrame reuseIdentifier:cellIdentifier] autorelease];  
      lblTemp = [[UILabel alloc] initWithFrame:Label1Frame];
      [lblTemp setFont:[UIFont fontWithName:@"austin power" size:40]];
      lblTemp.textColor = [UIColor redColor];
      lblTemp.tag = 1;
      lblTemp.backgroundColor=[UIColor clearColor];
      lblTemp.numberOfLines=0;
      [cell.contentView addSubview:lblTemp];
  
      return cell;
  }
  </code></pre>
  
  <p>Thank you
  oh btw its simulator 4.2 that I'm using.</p>