【发布时间】:2013-12-18 13:04:28
【问题描述】:
我正在尝试创建像 Facebook 这样的提要页面,我正在使用延迟加载将图像加载到 tableview 单元格中。有时会在任何随机单元格上出现滚动锁定,但是当我尝试在上方或下方的任何其他可见单元格上滚动时,它会滚动。这个问题非常零星。我无法纠正导致这种行为的原因。请帮忙。
这里是代码;
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//label to show values of the menu
static NSString *CellIdentifier = @"CellIdentifier";
// Dequeue or create a cell of the appropriate type.
socialFeedCustomCell *cell = (socialFeedCustomCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[socialFeedCustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] ;
cell.accessoryType = UITableViewCellAccessoryNone;
}
for (UIView *tempView in cell.contentView.subviews) {
[tempView removeFromSuperview];
}
[self renderInstagramData:indexPath cell:cell];
cell.contentView.layer.opaque=YES;
cell.layer.shouldRasterize = YES;
cell.layer.rasterizationScale = [UIScreen mainScreen].scale;
cell.selectionStyle=UITableViewCellSelectionStyleNone;
cell.backgroundColor=[UIColor clearColor];
cell.userInteractionEnabled=YES;
return cell;
}
谢谢
【问题讨论】:
-
显示您的代码和屏幕截图以便更好地理解。
-
无法通过截图显示滚动锁,可以考虑在tableview上滚动而停止滚动的情况。
-
关于我使用自定义单元格并将子视图添加到 tableview 的 contentview 的代码。
-
我真的不明白“有时会在任何随机单元格上出现滚动锁定,但是当我尝试在上方或下方的任何其他可见单元格上滚动时,它会滚动。”那什么意识?你能多描述一下情况并展示你的代码吗?
-
为了在 tableview 上滚动,我们需要在它上面滑动手指,假设我在一个单元格(任何随机单元格)上滑动手指并且它不滚动。您无法识别单元格,因为下次重新加载应用时,该单元格可以让您滚动。
标签: ios uitableview tableviewcell scroll-lock