gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 19:03:21 25 4
gpt4 key购买 nike

我发现 UITableView 第一次加载时,如果它的行数没有超过屏幕适合的行数,它不会响应滚动触摸。如果我关闭 View ,然后重新打开同一对象 - 它现在将响应触摸 - 即使它包含相同的行数。

除了响应 UITableViewDataSource 方法的行数并生成行本身之外,我没有做任何其他事情。每次 View 出现时我都会重新加载表格。

谁能解释一下这种行为吗?

<小时/>

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

- (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;
}

最佳答案

我也遇到了同样的问题。在IB中启用了Bounce Scroll,但仍然不爱。我必须像这样在代码中(在 viewDidLoad 中)设置它......

self.myTableView.bounces = YES;

希望这有帮助;-)

关于iphone - UITableView 第一次加载时不响应滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1449261/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com