gpt4 book ai didi

ios - 向下滚动屏幕后,UITableView 不会弹回

转载 作者:技术小花猫 更新时间:2023-10-29 10:53:07 28 4
gpt4 key购买 nike

这是一段视频:https://imgflip.com/gif/kgvcq

基本上,如果单元格滚动到屏幕底部边缘,它不会反弹回来。我已经尝试更新 tableViewcontentSize 但这似乎不是问题所在。我还确保声明了 rowHeight 但仍然没有成功。最后,我确保正确设置了 tableViewbounce 属性。

抱歉没有放代码,这里是:

// data source
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"frame height: %f", tableView.frame.size.height);
NSLog(@"content size height: %f", tableView.contentSize.height);

static NSString *CellIdentifier = @"HabitCell";

HabitTableViewCell *cell = (HabitTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell.viewController = self;
cell.delegate = self;

// edit cell

return cell;
}

NSLogs 分别返回:568 和 400。会不会是框架出问题了?另外,我没有覆盖 scrollViewDidScroll

实现的数据源方法

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// Return the number of rows in the section.
return [self.habits count];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if ([indexPath isEqual:_expandIndexPath]) {
return 450 + heightToAdd;
}
return 100;
}

最佳答案

已修复:我在我的 UIPanGestureRecognizer 方法中调用了 scrollToRowAtIndexPath。删除它,它现在可以完美运行。

关于ios - 向下滚动屏幕后,UITableView 不会弹回,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29779037/

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