【问题标题】:UITableView doesn't work fine when I use mask当我使用掩码时 UITableView 不能正常工作
【发布时间】:2013-07-03 14:59:09
【问题描述】:

我的 Tableview 仅加载 4 个单元格,但我有 25 个单元格...从 tableview 滚动滚动到 25 个单元,但是单元格很清晰...单元格的背景是白色的,从单元格 5 到 25 都是清除颜色背景和空白...我确实在 [listaPins 计数] 中设置了一个断点,并且确实有 25 个项目..

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [_listaPins count];
}

只调用 4 次

 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

编辑 我确实发现我评论了这段代码,tableview 工作正常。但这有什么问题?

UIBezierPath *maskPath;
maskPath = [UIBezierPath bezierPathWithRoundedRect:_tbFeeds.bounds byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerTopRight) cornerRadii:CGSizeMake(9.0, 9.0)];

CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = _tbFeeds.bounds;
maskLayer.path = maskPath.CGPath;
_tbFeeds.layer.mask = maskLayer;
[maskLayer release];

【问题讨论】:

  • 你的表格视图有多大?
  • 300x371 位置 x = 10 y = 108
  • 可能是单元重用的问题。我们需要查看您对tableView:cellForRowAtIndexPath: 的实施
  • 你的行高是多少
  • 我确实发现了问题,但不知道如何解决。请查看我的编辑

标签: objective-c uitableview ios5


【解决方案1】:

代码看起来很完美。请在屏蔽时检查表格的框架。尝试记录它。休息一切看起来都很好。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-03-17
    • 1970-01-01
    • 1970-01-01
    • 2019-11-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-03
    相关资源
    最近更新 更多