我发现第一次加载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)