UITableView does not respond to scrolling on first load

I found that the first time UITableView is launched, it does not respond to scrolling strokes - if it has no more lines than on the screen. If I close the view, then open the same object again - it will now respond to touches - although it contains the same number of lines.

I am not doing anything other than responding to UITableViewDataSource methods for the number of rows and creating the rows themselves. I reload the table every time a view appears.

Can someone explain this behavior?


I create cells like this:

- (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; } 
+4
source share
3 answers

I solved this problem by making sure that the table always has at least 10 rows β€” creating dummy rows if there are less than 10 real rows. This solved the problem.

0
source

I had the same problem. A bounce scroll has been included in IB, but still no love. I had to set it in code (in viewDidLoad), for example ...

 self.myTableView.bounces = YES; 

Hope this helps; -)

+17
source

What does your xib file look like? Do you have any opinions besides UITableView?

Earlier, when I studied programming iPhone, I somehow ended up with two UITableViews in my xib file - the table displayed correctly, but there were subtle problems.
0
source

All Articles