I am a newbie in iPhone software development. Recently I am working on a small application for iPhone that uses tableview control. My application displayed a list of data fine the first time when it came up, but when I scrolled up and down, the data in some cells got overrided. When I selected those cells, its data was overlapped by data of the next cells. It seemed that when I scrolled, the function - (UITableViewCell *)tableView

UITableView *)tableView cellForRowAtIndexPath

NSIndexPath *)indexPath got called many times. Here is the function:
- (UITableViewCell *)tableView

UITableView *)tableView cellForRowAtIndexPath

NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"MyIdentifier";
//CGRect cellRect = CGRectMake(0.0, 0.0, tableView.bounds.size.width, 100);
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
// Set up the cell...
NSDictionary *itemAtIndex = (NSDictionary *)[dataController objectInListAtIndex:indexPath.row];
NSString *text = [itemAtIndex objectForKey:@"originalQuote"];
CGSize textSize = {tableView.bounds.size.width - 5, 80.0f};
CGSize size = [text sizeWithFont:[UIFont systemFontOfSize:13.0f]constrainedToSize:textSize lineBreakMode:UILineBreakModeWordWrap];
CGRect contentRect = CGRectMake(5.0, 5.0, tableView.bounds.size.width - 5, size.height);
UILabel *textView = [[UILabel alloc] initWithFrame:contentRect];
textView.text = text;
textView.font = [UIFont systemFontOfSize:13];
textView.lineBreakMode = 0;
textView.numberOfLines = 10;
textView.textColor = [UIColor blackColor];
[cell.contentView addSubview:textView];
[text release];
[textView release];
return cell;
}
Can anyone please show me what I am doing wrong or what may be wrong in my application? Thanks a lot.