UITableView在第一次加载时不响应滚动

Ale*_*lex 4 iphone iphone-sdk-3.0

我发现第一次加载UITableView时,它不会响应滚动触摸 - 如果它没有比屏幕上更多的行.如果我关闭视图,然后重新打开同一个对象 - 它现在将响应触摸 - 即使它包含相同数量的行.

除了响应行数的UITableViewDataSource方法并自己生成行之外,我没有做任何事情.每次出现视图时我都在重新加载表格.

谁能解释这种行为?


我正在创建像这样的单元格:

- (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;  
}
Run Code Online (Sandbox Code Playgroud)

小智 18

我有同样的问题.Bounce Scroll已在IB中启用,但仍然没有爱.我不得不在代码中设置它(在viewDidLoad中),就像这样......

self.myTableView.bounces = YES;
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助 ;-)