Take the 2-minute tour ×

I have a UITableView with a top navigation bar. The data for the UITableView comes from an array which contains more than 20 objects.

Everything is fine so far. However sometimes when i do repeated scrolling (fast), I find last row being repeated, sometimes gets cut into half, overwritten.

I am new to iPhone development and have no clue why this happens.

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    // Return the number of sections.
    return 1;

    // Return the number of rows in the section.
    return [appDelegate.preList count];

// Customize the appearance of table view cells. 

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {

    // Configure the cell...
    Item *i=[appDelegate.preList objectAtIndex:indexPath.row];
    return cell;

I have attached a screenshot of my problem as well. Notice how the navigation bar and the last cell are.


Help would be greatly appreciated

share|improve this question
How did you set up your table view? –  Deepak Danduprolu Jun 7 '11 at 15:57
I have in IBOutlet declared in my header file and hooked it up in IB. –  Neelesh Jun 7 '11 at 16:03
What about your navigation bar. Is it scrolling with the table? –  Irene Jun 7 '11 at 16:12
add comment

2 Answers

up vote 3 down vote accepted

This looks like you have added two identical table views to your view. If you place a break point on numberOfSections… and then inspect the tableView object, I bet you will find two different table views. Start by looking for places in your code where you [self.view addSubview:tableView] or something similar. Remember, if you are using IB to setup your table, you do not need to programmatically add it.

share|improve this answer
I assumed it was something to do with reusing cells. Because when i scroll slowly this problem does not arise –  Neelesh Jun 7 '11 at 16:07
@Narayanan It seems there is some problem with your code not in the code you have pasted but somewhere else.If you can send your code I'll try to solve the problem –  Rahul Vyas Jun 7 '11 at 16:10
add comment

I think you are seeing this when scrolling fast because only then the tableView bounces leaving some content offset. You have probably added 2 tableViews back to back.

share|improve this answer
add comment

Your Answer


