views:

384

answers:

5

I have found that the first time a UITableView loads, it does not respond to scrolling touches -- if it does not have more rows than fit on the screen. If I close the view, then reopen the same object -- it will now respond to touches -- even though it contains the same number of rows.

I am not doing anything more than responding to the UITableViewDataSource methods for the number of rows, and generating the rows themselves. I am reloading the table every time the view appears.

Can anyone explain such behavior?

A: 

Assuming you have an Interface Builder (xib) file that contains your UITableView, what settings did you enable in Interface Builder for that view?

Alex Reynolds
Just the default settings with the delegate and datasources bound to the file's owner.
Alex
A: 

I am creating the cells like so:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
  static NSString *tableId = @"NewIndexTableId";
  Note *note = [notes objectAtIndex:[indexPath row]];

  UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:tableId];

  if (cell == nil)
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:tableId] autorelease];

  cell.textLabel.text = note.text;
  cell.detailTextLabel.text = [note changedDelta]; 
  cell.accessoryView = multipleAccounts ? [note.account imageView] : nil;

  return cell;  
}
Alex
A: 

What does your xib file look like? Do you have any views other than the UITableView?

Early on when I was learning iPhone programming, I somehow ended up with two UITableViews in my xib file - the table displayed properly, but was showing subtle problems.

alex_c
A: 

I solved this problem by making sure there are always at least 10 rows in the table -- creating dummy rows when there are less than 10 real rows. This solved the glitch.

Alex
A: 

I had same problem. Bounce Scroll was enabled in IB, but still no love. I had to set it in the code ( in viewDidLoad ) like so...

self.myTableView.bounces = YES;

Hope this helps ;-)

Mike
and if that fails do this...[self.tableView setAlwaysBounceVertical:YES];
Mike