title: Custom UITableViewCells with a programmatically created table
body: <p>When Ever I try to load data from an array into my table using custom cells it only shows the last cell like its overwriting all the cells until I Get to the end of the list. The table was created programmatically and when the cells don't load the blank table scrolls. If however I load the cells then only the last cell shows up and it won't scroll. </p>
  
  <p>I figure I made a typo or something but I can't really see anything that would be of much help. The parser works and the array is fine its just that the cells are acting strange. I wanted to make it so that I had a fixed bar over the table as well but first I needed to get the custom cells to show up in the table and scroll properly</p>
  
  <h2>schedule.h</h2>
  
  <pre><code>@interface Schedule : UIViewController &lt;UITableViewDelegate, UITableViewDataSource&gt; {
      IBOutlet UITableView *newsTable;
  
      UIActivityIndicatorView *activityIndicator;
  
      CGSize cellSize;
      NSXMLParser *fileParser;
  
      NSMutableArray * events;
  
  
      NSMutableArray * announcements;
  
      NSMutableDictionary * item;
  
      NSString *currentElement;
  
      NSMutableString * currentTitle, * currentDate, * currentSummary, * currentId, * curr    entTime, *currentContent; 
  
      UITableViewCell *appCell;
  }
  
  @property(nonatomic, retain)IBOutlet UITableView *newsTable;
  @property(nonatomic, retain)IBOutlet UITableViewCell *appCell;
  
  -(void)parseXMLFileAtURL:(NSString *)URL;
  
  @end
  </code></pre>
  
  <h2>schedule.m</h2>
  
  <pre><code>- (void)loadView{
  
      UITableView *tableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]
                                                        style:UITableViewStylePlain];
      tableView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;
  
      tableView.delegate = self;
      tableView.dataSource = self;
      tableView.tag = 4;
      [tableView reloadData];
  
      self.view = tableView;
      [tableView release];
  
  }
  
  - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
      return 1;
  }
  
  // Customize the number of rows in the table view.
  - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section        {
      return [events count];
  }
  
  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  
      static NSString *CellIdentifier = @"MyCell";
  
      UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
      if (cell == nil) {
          [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil];
          cell = appCell;
          self.appCell = nil;
      }
  
      // Configure the cell.
      UILabel *label;
      label = (UILabel *)[cell viewWithTag:1];
      int eventIndex = [indexPath indexAtPosition: [indexPath length] - 1];
      label.text = [[events objectAtIndex: eventIndex] objectForKey: @"event"];
  
      return cell;
  }
  - (void)parserDidEndDocument:(NSXMLParser *)parser {
  
      NSLog(@"webpage parsed");
      NSLog(@"events array has %d items", [events count]);
      newsTable = (UITableView*)[self.view viewWithTag:4];
      [newsTable reloadData];
  }
  </code></pre>
  
  <p>I added more code the problem may be somewhere else. </p>