title: Table view method cell for row at index path again reloading and then app crashing
body: <p>In my app I have a table view and 4 images view in one row. When I scroll the table view then cell for row at index path method is again called and then the app crashes. How can I prevent table view reloading when scrolling. My part of code is :-</p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
      UITableViewCell *cell = nil;
      static NSString *AutoCompleteRowIdentifier = @"AutoCompleteRowIdentifier";
  
  
      cell = [tableView dequeueReusableCellWithIdentifier:AutoCompleteRowIdentifier];
      if (cell == nil) {
          cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:AutoCompleteRowIdentifier] autorelease];
  
          for (int i=0; i &lt;= [wordsInSentence count]; ++i) {
              UIImageView *imageView1 = [[[UIImageView alloc] initWithFrame:CGRectMake(30+90*(i%4), 15, 80, 100)] autorelease] ;
              imageView1.tag = i+1;
  
              [imageViewArray insertObject:imageView1 atIndex:i];
              [cell.contentView addSubview:imageView1];
          }
  
      }
  
      int photosInRow;
  
      if ( (indexPath.row &lt; [tableView numberOfRowsInSection:indexPath.section] - 1) || ([wordsInSentence count] % 4 == 0) ) {
          photosInRow = 4;
      } else {
          photosInRow = [wordsInSentence count] % 4;
      }
  
      for ( int i = 1; i &lt;=photosInRow ; i++ ){
          imageView = (UIImageView *)[cell.contentView viewWithTag:j];
          [self showImage:imageView];
      }
  
      return cell;
  }
  </code></pre>
  
  <p>Please help. Any help will be appreciated.</p>
  
  <p>Thanks,
  Christy</p>